File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 1010 "url" : " git+https://github.com/DavidWells/analytics.git"
1111 },
1212 "main" : " dist/index.js" ,
13+ "types" : " dist/index.d.ts" ,
1314 "module" : " dist/index.modern.js" ,
1415 "source" : " src/index.js" ,
1516 "engines" : {
1617 "node" : " >=10"
1718 },
1819 "scripts" : {
19- "build" : " microbundle --no-compress --format modern,cjs --jsx 'React.createElement' --jsxImportSource react --globals react/jsx-runtime=jsx" ,
20+ "types" : " cp ./src/index.d.ts ./dist/index.d.ts" ,
21+ "build" : " microbundle --no-compress --format modern,cjs --jsx 'React.createElement' --jsxImportSource react --globals react/jsx-runtime=jsx && npm run types" ,
2022 "watch" : " microbundle watch --no-compress --format modern,cjs --jsx 'React.createElement' --jsxImportSource react --globals react/jsx-runtime=jsx" ,
2123 "release:patch" : " npm version patch && npm publish" ,
2224 "release:minor" : " npm version minor && npm publish" ,
Original file line number Diff line number Diff line change 1+ declare module 'use-analytics' {
2+ import type { ComponentType , Context , FC , ReactNode } from 'react' ;
3+ import type { AnalyticsInstance } from 'analytics' ;
4+
5+ export function withAnalytics < P extends object > ( Component : ComponentType < P > ) : FC < P > ;
6+
7+ export function useAnalytics ( ) : AnalyticsInstance ;
8+ export function useTrack ( ) : AnalyticsInstance [ 'track' ] ;
9+ export function usePage ( ) : AnalyticsInstance [ 'page' ] ;
10+ export function useIdentify ( ) : AnalyticsInstance [ 'identify' ] ;
11+
12+ export const AnalyticsConsumer : Context < AnalyticsInstance > [ 'Consumer' ] ;
13+ export const AnalyticsContext : Context < AnalyticsInstance > ;
14+
15+ export function AnalyticsProvider ( props : {
16+ instance : AnalyticsInstance ;
17+ children : ReactNode ;
18+ } ) : JSX . Element ;
19+ }
You can’t perform that action at this time.
0 commit comments