Use defaults for transpileModule (#31563)
This commit is contained in:
parent
05af8faac6
commit
9133e7ad0e
|
@ -26,7 +26,15 @@ namespace ts {
|
|||
export function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput {
|
||||
const diagnostics: Diagnostic[] = [];
|
||||
|
||||
const options: CompilerOptions = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : getDefaultCompilerOptions();
|
||||
const options: CompilerOptions = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : {};
|
||||
|
||||
// mix in default options
|
||||
const defaultOptions = getDefaultCompilerOptions();
|
||||
for (const key in defaultOptions) {
|
||||
if (hasProperty(defaultOptions, key) && options[key] === undefined) {
|
||||
options[key] = defaultOptions[key];
|
||||
}
|
||||
}
|
||||
|
||||
options.isolatedModules = true;
|
||||
|
||||
|
|
|
@ -17,7 +17,10 @@ namespace ts {
|
|||
|
||||
transpileOptions = testSettings.options || {};
|
||||
if (!transpileOptions.compilerOptions) {
|
||||
transpileOptions.compilerOptions = {};
|
||||
transpileOptions.compilerOptions = { };
|
||||
}
|
||||
if (transpileOptions.compilerOptions.target === undefined) {
|
||||
transpileOptions.compilerOptions.target = ScriptTarget.ES3;
|
||||
}
|
||||
|
||||
if (transpileOptions.compilerOptions.newLine === undefined) {
|
||||
|
|
Loading…
Reference in a new issue