File tree 2 files changed +22
-1
lines changed
2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 10
10
"url" : " git+https://github.com/DavidWells/analytics.git"
11
11
},
12
12
"main" : " dist/index.js" ,
13
+ "types" : " dist/index.d.ts" ,
13
14
"module" : " dist/index.modern.js" ,
14
15
"source" : " src/index.js" ,
15
16
"engines" : {
16
17
"node" : " >=10"
17
18
},
18
19
"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" ,
20
22
"watch" : " microbundle watch --no-compress --format modern,cjs --jsx 'React.createElement' --jsxImportSource react --globals react/jsx-runtime=jsx" ,
21
23
"release:patch" : " npm version patch && npm publish" ,
22
24
"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