From a73ae63fa3f2aa619a7d1ca4ebe8da4daecbaa4e Mon Sep 17 00:00:00 2001 From: Abhishek Gupta Date: Sat, 28 Mar 2020 21:34:04 +0530 Subject: [PATCH 1/3] move types to dev deps --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 0701375..62e0518 100644 --- a/package.json +++ b/package.json @@ -26,13 +26,13 @@ }, "homepage": "https://github.com/championswimmer/express-universal-analytics#readme", "dependencies": { - "universal-analytics": "^0.4.20", - "@types/express": "^4.17.3", - "@types/express-session": "^1.17.0", - "@types/universal-analytics": "^0.4.4" + "universal-analytics": "^0.4.20" }, "devDependencies": { "@types/node": "10", + "@types/express": "^4.17.3", + "@types/express-session": "^1.17.0", + "@types/universal-analytics": "^0.4.4", "express": "^4.17.1", "express-session": "^1.17.0", "typescript": "^3.8.3" From f244bb5b7d0f7b2e7d1e48408d5ce4a4f93806fe Mon Sep 17 00:00:00 2001 From: Abhishek Gupta Date: Tue, 31 Mar 2020 19:41:32 +0530 Subject: [PATCH 2/3] fix typescript compilation --- types/express.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/express.d.ts b/types/express.d.ts index 379af07..dcd3f2a 100644 --- a/types/express.d.ts +++ b/types/express.d.ts @@ -1,7 +1,7 @@ import * as ua from "universal-analytics"; -declare module 'express-serve-static-core' { - interface Request { - visitor: ua.Visitor & { setUid: (uid?: string) => void } +declare module 'express' { + export interface Request { + visitor?: ua.Visitor & { setUid: (uid?: string) => void } } } From 1b283705dc0239e82e6a41e74733a77f666b098f Mon Sep 17 00:00:00 2001 From: Abhishek Gupta Date: Wed, 1 Apr 2020 16:48:11 +0530 Subject: [PATCH 3/3] add types to dist --- .gitignore | 2 +- dist/index.d.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 dist/index.d.ts diff --git a/.gitignore b/.gitignore index fd250c1..3c642e4 100644 --- a/.gitignore +++ b/.gitignore @@ -91,4 +91,4 @@ jspm_packages .yarn-integrity # Build -dist/ \ No newline at end of file +# dist/ \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..798b57e --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,16 @@ +/** + * Created by championswimmer on 05/01/17. + */ +import { Request, RequestHandler } from 'express'; +export interface ReqToUserId { + (req: Request): string; +} +interface ExpressGAParams { + uaCode: string; + cookieName?: string; + reqToUserId?: ReqToUserId; + autoTrackPages?: boolean; +} +declare function ExpressGA(uaCode: string): RequestHandler; +declare function ExpressGA(params: ExpressGAParams): RequestHandler; +export default ExpressGA;