From b57d44c4c9bfff531b35a9210b9d2d3a84d24aba Mon Sep 17 00:00:00 2001 From: Olga Isakova Date: Tue, 19 Feb 2019 02:02:28 +0500 Subject: [PATCH 1/4] Adjust the export to work with esModuleInterop --- types/mongo-sanitize/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/mongo-sanitize/index.d.ts b/types/mongo-sanitize/index.d.ts index 44c5d04a7d..1c5308d55c 100644 --- a/types/mongo-sanitize/index.d.ts +++ b/types/mongo-sanitize/index.d.ts @@ -1,9 +1,9 @@ // Type definitions for mongo-sanitize 1.0 // Project: https://github.com/vkarpov15/mongo-sanitize -// Definitions by: Cedric Cazin +// Definitions by: Cedric Cazin , Olga Isakova // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -export function sanitize(v: T): T; +declare function sanitize(v: T): T; -export as namespace mongoSanitize; +export = sanitize; From 5bf116d71b09273334b70f5e96a272ad5fa4c104 Mon Sep 17 00:00:00 2001 From: Olga Isakova Date: Tue, 19 Feb 2019 02:19:33 +0500 Subject: [PATCH 2/4] Tests, TS version --- types/mongo-sanitize/index.d.ts | 2 +- types/mongo-sanitize/mongo-sanitize-tests.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/types/mongo-sanitize/index.d.ts b/types/mongo-sanitize/index.d.ts index 1c5308d55c..aedff46b0b 100644 --- a/types/mongo-sanitize/index.d.ts +++ b/types/mongo-sanitize/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/vkarpov15/mongo-sanitize // Definitions by: Cedric Cazin , Olga Isakova // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 3.3 declare function sanitize(v: T): T; diff --git a/types/mongo-sanitize/mongo-sanitize-tests.ts b/types/mongo-sanitize/mongo-sanitize-tests.ts index 4d4534bbeb..3f86dc256e 100644 --- a/types/mongo-sanitize/mongo-sanitize-tests.ts +++ b/types/mongo-sanitize/mongo-sanitize-tests.ts @@ -1,11 +1,11 @@ -import * as mongoSanitize from 'mongo-sanitize'; +import sanitize from "mongo-sanitize"; -const objectSanitized = mongoSanitize.sanitize({ $gt: 5, a: 1 }); +const objectSanitized = sanitize({ $gt: 5, a: 1 }); -const arraySanitized = mongoSanitize.sanitize([1, 2, 3]); +const arraySanitized = sanitize([1, 2, 3]); class Clazz { $gt = 5; a = 1; } -const classSanitized = mongoSanitize.sanitize(new Clazz()); +const classSanitized = sanitize(new Clazz()); From a29a526c915dbf7d74b7e02a9806afbeea4f7f28 Mon Sep 17 00:00:00 2001 From: Olga Isakova Date: Sun, 10 Mar 2019 22:33:20 +0300 Subject: [PATCH 3/4] TS version back to 2.3 I tested with 3.3 and thought the comment referred to the latest compatible version. But yes, 3.3 is not a requirement. --- types/mongo-sanitize/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mongo-sanitize/index.d.ts b/types/mongo-sanitize/index.d.ts index aedff46b0b..1c5308d55c 100644 --- a/types/mongo-sanitize/index.d.ts +++ b/types/mongo-sanitize/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/vkarpov15/mongo-sanitize // Definitions by: Cedric Cazin , Olga Isakova // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.3 +// TypeScript Version: 2.3 declare function sanitize(v: T): T; From ac041e3704e81a56b7c12d1dd2be4d5a6e302706 Mon Sep 17 00:00:00 2001 From: Olga Isakova Date: Sun, 10 Mar 2019 23:45:18 +0300 Subject: [PATCH 4/4] Version 2.7 import foo from "foo" from CommonJS modules is only possible since TS v2.7 --- types/mongo-sanitize/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mongo-sanitize/index.d.ts b/types/mongo-sanitize/index.d.ts index 1c5308d55c..cf187384a4 100644 --- a/types/mongo-sanitize/index.d.ts +++ b/types/mongo-sanitize/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/vkarpov15/mongo-sanitize // Definitions by: Cedric Cazin , Olga Isakova // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.7 declare function sanitize(v: T): T;