Merge pull request #9174 from Microsoft/Fix9173
Fix #9173: clear out lib and types before creating a program in transpileModule
This commit is contained in:
commit
38c89af6b2
2 changed files with 22 additions and 0 deletions
|
@ -2001,6 +2001,10 @@ namespace ts {
|
|||
// so pass --noLib to avoid reporting a file not found error.
|
||||
options.noLib = true;
|
||||
|
||||
// Clear out the lib and types option as well
|
||||
options.lib = undefined;
|
||||
options.types = undefined;
|
||||
|
||||
// We are not doing a full typecheck, we are not resolving the whole context,
|
||||
// so pass --noResolve to avoid reporting missing file errors.
|
||||
options.noResolve = true;
|
||||
|
|
|
@ -304,6 +304,24 @@ var x = 0;`,
|
|||
test("var x", { expectedOutput: `"use strict";\r\nvar x;\r\n`, options: { fileName: "http://somewhere/directory//directory2/file.ts" } });
|
||||
});
|
||||
|
||||
it("Support options with lib values", () => {
|
||||
const input = "const a = 10;";
|
||||
const output = `"use strict";\r\nvar a = 10;\r\n`;
|
||||
test(input, {
|
||||
expectedOutput: output,
|
||||
options: { compilerOptions: { lib: ["es6", "dom"], module: ModuleKind.CommonJS }, fileName: "input.js", reportDiagnostics: true }
|
||||
});
|
||||
});
|
||||
|
||||
it("Support options with types values", () => {
|
||||
const input = "const a = 10;";
|
||||
const output = `"use strict";\r\nvar a = 10;\r\n`;
|
||||
test(input, {
|
||||
expectedOutput: output,
|
||||
options: { compilerOptions: { types: ["jquery", "typescript"], module: ModuleKind.CommonJS }, fileName: "input.js", reportDiagnostics: true }
|
||||
});
|
||||
});
|
||||
|
||||
describe("String values for enums", () => {
|
||||
it("Accepts strings instead of enum values", () => {
|
||||
test(`export const x = 0`, {
|
||||
|
|
Loading…
Reference in a new issue