From 1aad431d7d85d5cd3bbbd3ca043f0997e666e3e7 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 9 Mar 2017 21:25:49 -0800 Subject: [PATCH] node: Set "lib" to "es5" (#15093) --- node/index.d.ts | 11 +++++++++++ node/node-tests.ts | 4 ++-- node/tsconfig.json | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/node/index.d.ts b/node/index.d.ts index 18b12ce5d2..ca6e83a267 100644 --- a/node/index.d.ts +++ b/node/index.d.ts @@ -40,6 +40,17 @@ interface WeakMapConstructor { } interface SetConstructor { } interface WeakSetConstructor { } +// Forward-declare needed types from lib.es2015.d.ts (in case users are using `--lib es5`) +interface Iterable {} +interface Iterator { + next(value?: any): IteratorResult; +} +interface IteratorResult {} +interface SymbolConstructor { + readonly iterator: symbol; +} +declare var Symbol: SymbolConstructor; + /************************************************ * * * GLOBAL * diff --git a/node/node-tests.ts b/node/node-tests.ts index 7a50504d5b..04166bc006 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -520,7 +520,7 @@ function stream_readable_pipe_test() { assert(typeof r.bytesRead === 'number'); assert(typeof r.path === 'string'); - assert(typeof rs.path === 'Buffer'); + assert(rs.path instanceof Buffer); r.pipe(z).pipe(w); @@ -2159,7 +2159,7 @@ namespace v8_tests { const heapStats = v8.getHeapStatistics(); const heapSpaceStats = v8.getHeapSpaceStatistics(); - + const zapsGarbage: number = heapStats.does_zap_garbage; v8.setFlagsFromString('--collect_maps'); diff --git a/node/tsconfig.json b/node/tsconfig.json index 640b4f775e..5914d22a4c 100644 --- a/node/tsconfig.json +++ b/node/tsconfig.json @@ -6,7 +6,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es5" ], "noImplicitAny": true, "noImplicitThis": true,