isolatedModules does not imply every file is a module (#54218)

This commit is contained in:
Andrew Branch
2023-05-12 15:14:49 -07:00
committed by GitHub
parent 08285abaec
commit f0ff97611f
16 changed files with 50 additions and 40 deletions

View File

@@ -130,7 +130,7 @@ var x = 0;`, {
testVerbatimModuleSyntax: true
});
transpilesCorrectly("Generates module output", `var x = 0;`, {
transpilesCorrectly("Generates module output", `var x = 0; export {};`, {
options: { compilerOptions: { module: ts.ModuleKind.AMD } }
});
@@ -139,7 +139,7 @@ var x = 0;`, {
testVerbatimModuleSyntax: true
});
transpilesCorrectly("Sets module name", "var x = 1;", {
transpilesCorrectly("Sets module name", "var x = 1; export {};", {
options: { compilerOptions: { module: ts.ModuleKind.System, newLine: ts.NewLineKind.LineFeed }, moduleName: "NamedModule" }
});

View File

@@ -304,6 +304,7 @@ describe("unittests:: TransformAPI", () => {
target: ts.ScriptTarget.ES5,
module: ts.ModuleKind.System,
newLine: ts.NewLineKind.CarriageReturnLineFeed,
moduleDetection: ts.ModuleDetectionKind.Force,
}
}).outputText;