Skip to content

Commit

Permalink
fix(cli): add lib dom.asynciterable (denoland#9288)
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsonk committed Jan 28, 2021
1 parent 5cf1943 commit 7bda0f5
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cli/dts/lib.dom.asynciterable.d.ts
Original file line number Diff line number Diff line change
@@ -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>;
}
5 changes: 5 additions & 0 deletions cli/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
23 changes: 23 additions & 0 deletions cli/tests/lib_dom_asynciterable.ts
Original file line number Diff line number Diff line change
@@ -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());
2 changes: 2 additions & 0 deletions cli/tests/lib_dom_asynciterable.ts.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[]
[ "[WILDCARD]/main.ts.js", "[WILDCARD]/main.ts.js.map" ]
1 change: 1 addition & 0 deletions cli/tsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
1 change: 1 addition & 0 deletions cli/tsc/00_typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down

0 comments on commit 7bda0f5

Please sign in to comment.