From 046bbb26913f9da58b0d23ae331e9dab9dc19e59 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Wed, 19 Feb 2020 16:34:11 +1100 Subject: Support loading additional TS lib files (#3863) Fixes #3726 This PR provides support for referencing other lib files (like lib.dom.d.ts that are not used by default in Deno. --- cli/js/compiler_api_test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'cli/js/compiler_api_test.ts') diff --git a/cli/js/compiler_api_test.ts b/cli/js/compiler_api_test.ts index eef12c8cc..a6baecbf5 100644 --- a/cli/js/compiler_api_test.ts +++ b/cli/js/compiler_api_test.ts @@ -46,6 +46,22 @@ test(async function compilerApiCompileOptions() { assert(actual["/foo.js"].startsWith("define(")); }); +test(async function compilerApiCompileLib() { + const [diagnostics, actual] = await compile( + "/foo.ts", + { + "/foo.ts": `console.log(document.getElementById("foo")); + console.log(Deno.args);` + }, + { + lib: ["dom", "es2018", "deno.ns"] + } + ); + assert(diagnostics == null); + assert(actual); + assertEquals(Object.keys(actual), ["/foo.js.map", "/foo.js"]); +}); + test(async function transpileOnlyApi() { const actual = await transpileOnly({ "foo.ts": `export enum Foo { Foo, Bar, Baz };\n` -- cgit v1.2.3