From 48268a44806c7c3f2e41d592f8ad8566ae033dad Mon Sep 17 00:00:00 2001 From: Diogo Franco Date: Tue, 4 Jul 2017 17:41:00 +0900 Subject: [PATCH 1/3] Correct ua-parser-js's export ua-parser-js is _not_ an ES module; it is a handwritten AMD module. It exports itself both by setting the UAParser class as the export and adding a self-reference with the same name, which is why the current definition happens to work with the current commonjs emit. --- types/ua-parser-js/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/ua-parser-js/index.d.ts b/types/ua-parser-js/index.d.ts index 9926e4f961..06990399f5 100644 --- a/types/ua-parser-js/index.d.ts +++ b/types/ua-parser-js/index.d.ts @@ -139,7 +139,7 @@ declare namespace IUAParser { } declare module "ua-parser-js" { - export class UAParser { + class UAParser { static VERSION: string; static BROWSER: IUAParser.BROWSER; static CPU: IUAParser.CPU; @@ -192,5 +192,6 @@ declare module "ua-parser-js" { */ getResult(): IUAParser.IResult; } + const exported: typeof UAParser & { UAParser: UAParser }; + export = exported } - From 72db55deb011d96e208fb8fc95a8aa341031df41 Mon Sep 17 00:00:00 2001 From: Diogo Franco Date: Tue, 4 Jul 2017 17:43:22 +0900 Subject: [PATCH 2/3] ua-parser-js: add missing typeof --- types/ua-parser-js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/ua-parser-js/index.d.ts b/types/ua-parser-js/index.d.ts index 06990399f5..f11eac1ba8 100644 --- a/types/ua-parser-js/index.d.ts +++ b/types/ua-parser-js/index.d.ts @@ -192,6 +192,6 @@ declare module "ua-parser-js" { */ getResult(): IUAParser.IResult; } - const exported: typeof UAParser & { UAParser: UAParser }; + const exported: typeof UAParser & { UAParser: typeof UAParser }; export = exported } From c22a4bfcf3ef4caeaf1470c5b801f5de1c0ed8d4 Mon Sep 17 00:00:00 2001 From: Diogo Franco Date: Tue, 4 Jul 2017 17:53:55 +0900 Subject: [PATCH 3/3] ua-parser-js: update tests --- types/ua-parser-js/ua-parser-js-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/ua-parser-js/ua-parser-js-tests.ts b/types/ua-parser-js/ua-parser-js-tests.ts index 709ee380ff..e5f5cca4c3 100644 --- a/types/ua-parser-js/ua-parser-js-tests.ts +++ b/types/ua-parser-js/ua-parser-js-tests.ts @@ -1,4 +1,4 @@ -import {UAParser} from 'ua-parser-js'; +import UAParser = require('ua-parser-js'); function test_parser() { var ua = 'Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1090.0 Safari/536.6';