diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2021-01-29 06:41:30 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-29 06:41:30 +1100 |
commit | 7bda0f567ec7e1a688b41b6026c6124656cd413a (patch) | |
tree | 481a497a09f5b7e035c05bb540ba245fe68afbfd | |
parent | 5cf194380bcad0fd763fb0893ec49bfc91fda15d (diff) |
fix(cli): add lib dom.asynciterable (#9288)
Fixes #9218
-rw-r--r-- | cli/dts/lib.dom.asynciterable.d.ts | 9 | ||||
-rw-r--r-- | cli/tests/integration_tests.rs | 5 | ||||
-rw-r--r-- | cli/tests/lib_dom_asynciterable.ts | 23 | ||||
-rw-r--r-- | cli/tests/lib_dom_asynciterable.ts.out | 2 | ||||
-rw-r--r-- | cli/tsc.rs | 1 | ||||
-rw-r--r-- | cli/tsc/00_typescript.js | 1 |
6 files changed, 41 insertions, 0 deletions
diff --git a/cli/dts/lib.dom.asynciterable.d.ts b/cli/dts/lib.dom.asynciterable.d.ts new file mode 100644 index 000000000..fcf5750cf --- /dev/null +++ b/cli/dts/lib.dom.asynciterable.d.ts @@ -0,0 +1,9 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. + +/// <reference no-default-lib="true"/> + +interface ReadableStream<R = any> { + [Symbol.asyncIterator](options?: { + preventCancel?: boolean; + }): AsyncIterableIterator<R>; +} diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 1e64f3cdd..662b0e277 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -3104,6 +3104,11 @@ itest!(runtime_decorators { output: "runtime_decorators.ts.out", }); +itest!(lib_dom_asynciterable { + args: "run --quiet --unstable --reload lib_dom_asynciterable.ts", + output: "lib_dom_asynciterable.ts.out", +}); + itest!(lib_ref { args: "run --quiet --unstable --reload lib_ref.ts", output: "lib_ref.ts.out", diff --git a/cli/tests/lib_dom_asynciterable.ts b/cli/tests/lib_dom_asynciterable.ts new file mode 100644 index 000000000..d932011f4 --- /dev/null +++ b/cli/tests/lib_dom_asynciterable.ts @@ -0,0 +1,23 @@ +const { diagnostics, files } = await Deno.emit("/main.ts", { + compilerOptions: { + target: "esnext", + lib: ["esnext", "dom", "dom.iterable", "dom.asynciterable"], + }, + sources: { + "/main.ts": `const rs = new ReadableStream<string>({ + start(c) { + c.enqueue("hello"); + c.enqueue("deno"); + c.close(); + } + }); + + for await (const s of rs) { + console.log("s"); + } + `, + }, +}); + +console.log(diagnostics); +console.log(Object.keys(files).sort()); diff --git a/cli/tests/lib_dom_asynciterable.ts.out b/cli/tests/lib_dom_asynciterable.ts.out new file mode 100644 index 000000000..8b5e7adb6 --- /dev/null +++ b/cli/tests/lib_dom_asynciterable.ts.out @@ -0,0 +1,2 @@ +[] +[ "[WILDCARD]/main.ts.js", "[WILDCARD]/main.ts.js.map" ] diff --git a/cli/tsc.rs b/cli/tsc.rs index 26b0c68fb..9e32c1908 100644 --- a/cli/tsc.rs +++ b/cli/tsc.rs @@ -52,6 +52,7 @@ pub fn get_asset(asset: &str) -> Option<&'static str> { }; } match asset { + "lib.dom.asynciterable.d.ts" => inc!("lib.dom.asynciterable.d.ts"), "lib.dom.d.ts" => inc!("lib.dom.d.ts"), "lib.dom.iterable.d.ts" => inc!("lib.dom.iterable.d.ts"), "lib.es6.d.ts" => inc!("lib.es6.d.ts"), diff --git a/cli/tsc/00_typescript.js b/cli/tsc/00_typescript.js index ea89c6ac4..a82924388 100644 --- a/cli/tsc/00_typescript.js +++ b/cli/tsc/00_typescript.js @@ -35757,6 +35757,7 @@ var ts; ["es2020", "lib.es2020.d.ts"], ["esnext", "lib.esnext.d.ts"], // Host only + ["dom.asynciterable", "lib.dom.asynciterable.d.ts"], ["dom", "lib.dom.d.ts"], ["dom.iterable", "lib.dom.iterable.d.ts"], ["webworker", "lib.webworker.d.ts"], |