mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 04:39:10 +00:00
feat: Support types compiler option in compiler APIs (#4155)
Handles `types` in the compiler APIs to make it easier to supply external type libraries.
This commit is contained in:
parent
daf7617f42
commit
1d26da6a47
6 changed files with 91 additions and 7 deletions
|
@ -62,6 +62,21 @@ test(async function compilerApiCompileLib() {
|
|||
assertEquals(Object.keys(actual), ["/foo.js.map", "/foo.js"]);
|
||||
});
|
||||
|
||||
test(async function compilerApiCompileTypes() {
|
||||
const [diagnostics, actual] = await compile(
|
||||
"/foo.ts",
|
||||
{
|
||||
"/foo.ts": `console.log(Foo.bar);`
|
||||
},
|
||||
{
|
||||
types: ["./cli/tests/subdir/foo_types.d.ts"]
|
||||
}
|
||||
);
|
||||
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`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue