Ignore allowImportingTsExtensions in transpileModule to suppress option validation error with noEmit (#53599)

This commit is contained in:
Andrew Branch
2023-03-31 09:10:49 -07:00
committed by GitHub
parent 13c374a868
commit b29ed18466
10 changed files with 31 additions and 0 deletions

View File

@@ -1105,6 +1105,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [
category: Diagnostics.Modules,
description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noEmit_or_emitDeclarationOnly_to_be_set,
defaultValueDescription: false,
transpileOptionValue: undefined,
},
{
name: "resolvePackageJsonExports",

View File

@@ -606,4 +606,18 @@ export * as alias from './file';`, {
testVerbatimModuleSyntax: "only"
}
);
transpilesCorrectly("Can transpile .ts extensions without error",
`import { foo } from "./foo.ts";`, {
options: { compilerOptions: { module: ts.ModuleKind.ESNext, target: ts.ScriptTarget.ESNext } },
testVerbatimModuleSyntax: true
}
);
transpilesCorrectly("Ignores `allowImportingTsExtensions` without `noEmit` error",
`import { foo } from "./foo.ts";`, {
options: { compilerOptions: { module: ts.ModuleKind.ESNext, allowImportingTsExtensions: true, target: ts.ScriptTarget.ESNext } },
testVerbatimModuleSyntax: true
}
);
});

View File

@@ -0,0 +1,2 @@
import { foo } from "./foo.ts";
//# sourceMappingURL=file.js.map

View File

@@ -0,0 +1,2 @@
import { foo } from "./foo.ts";
//# sourceMappingURL=file.js.map

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=file.js.map

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=file.js.map

View File

@@ -0,0 +1,2 @@
import { foo } from "./foo.ts";
//# sourceMappingURL=file.js.map

View File

@@ -0,0 +1,2 @@
import { foo } from "./foo.ts";
//# sourceMappingURL=file.js.map

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=file.js.map

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=file.js.map