Skip to content

Commit 9d9dc79

Browse files
refactor: from Flow to TS, with React Hooks
1 parent fc86ed5 commit 9d9dc79

File tree

15 files changed

+627
-260
lines changed

15 files changed

+627
-260
lines changed

.babelrc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"presets": [
3-
"@babel/preset-flow",
4-
"@babel/preset-env",
5-
"@babel/preset-react"
2+
"presets": ["@babel/env", "@babel/typescript", "@babel/react"],
3+
"plugins": [
4+
"@babel/proposal-class-properties",
5+
"@babel/proposal-object-rest-spread"
66
]
77
}

.flowconfig

Lines changed: 0 additions & 11 deletions
This file was deleted.

index.js

Lines changed: 0 additions & 83 deletions
This file was deleted.

lib/hooks.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { GATrackingId } from "./types";
2+
export declare function usePrevious(value: any): undefined;
3+
export declare function useGA(id?: GATrackingId): void;
4+
export declare function usePageViews(trackPathnameOnly: boolean, basename: string, debug?: boolean): void;

lib/hooks.js

Lines changed: 71 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/// <reference types="react" />
2+
import { ReactRouterGAProps } from "./types";
3+
declare function ReactRouterGA(props: ReactRouterGAProps): import("react").ReactNode;
4+
export default ReactRouterGA;

lib/index.js

Lines changed: 8 additions & 113 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/types.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/// <reference types="react" />
2+
export declare type GATrackingId = string;
3+
export interface ReactRouterGAProps {
4+
id?: GATrackingId;
5+
basename: string;
6+
trackPathnameOnly: boolean;
7+
children?: React.ReactNode;
8+
debug?: boolean;
9+
}

lib/types.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)