mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-22 22:55:36 -05:00
Allow 'verbatimModuleSyntax' with transpileModule (#53240)
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
This commit is contained in:
@@ -43,6 +43,12 @@ export interface TranspileOutput {
|
||||
sourceMapText?: string;
|
||||
}
|
||||
|
||||
const optionsRedundantWithVerbatimModuleSyntax = new Set([
|
||||
"isolatedModules",
|
||||
"preserveValueImports",
|
||||
"importsNotUsedAsValues"
|
||||
]);
|
||||
|
||||
/*
|
||||
* This function will compile source text from 'input' argument using specified compiler options.
|
||||
* If not options are provided - it will use a set of default compiler options.
|
||||
@@ -66,6 +72,11 @@ export function transpileModule(input: string, transpileOptions: TranspileOption
|
||||
}
|
||||
|
||||
for (const option of transpileOptionValueCompilerOptions) {
|
||||
// Do not set redundant config options if `verbatimModuleSyntax` was supplied.
|
||||
if (options.verbatimModuleSyntax && optionsRedundantWithVerbatimModuleSyntax.has(option.name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
options[option.name] = option.transpileOptionValue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user