mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Ensure harness doesn't force or eagerly computes target, stop using raw target elsewhere (#57526)
This commit is contained in:
@@ -144,6 +144,7 @@ import {
|
||||
getEmitFlags,
|
||||
getEmitHelpers,
|
||||
getEmitModuleKind,
|
||||
getEmitScriptTarget,
|
||||
getExternalHelpersModuleName,
|
||||
getExternalModuleName,
|
||||
getIdentifierTypeArguments,
|
||||
@@ -856,8 +857,8 @@ export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFi
|
||||
removeComments: compilerOptions.removeComments,
|
||||
newLine: compilerOptions.newLine,
|
||||
noEmitHelpers: compilerOptions.noEmitHelpers,
|
||||
module: compilerOptions.module,
|
||||
target: compilerOptions.target,
|
||||
module: getEmitModuleKind(compilerOptions),
|
||||
target: getEmitScriptTarget(compilerOptions),
|
||||
sourceMap: compilerOptions.sourceMap,
|
||||
inlineSourceMap: compilerOptions.inlineSourceMap,
|
||||
inlineSources: compilerOptions.inlineSources,
|
||||
|
||||
@@ -257,7 +257,6 @@ export function compileFiles(host: fakes.CompilerHost, rootFiles: string[] | und
|
||||
}
|
||||
|
||||
// establish defaults (aligns with old harness)
|
||||
if (compilerOptions.target === undefined && compilerOptions.module !== ts.ModuleKind.Node16 && compilerOptions.module !== ts.ModuleKind.NodeNext) compilerOptions.target = ts.ScriptTarget.ES3;
|
||||
if (compilerOptions.newLine === undefined) compilerOptions.newLine = ts.NewLineKind.CarriageReturnLineFeed;
|
||||
if (compilerOptions.skipDefaultLibCheck === undefined) compilerOptions.skipDefaultLibCheck = true;
|
||||
if (compilerOptions.noErrorTruncation === undefined) compilerOptions.noErrorTruncation = true;
|
||||
|
||||
@@ -380,7 +380,6 @@ export namespace Compiler {
|
||||
symlinks?: vfs.FileSet,
|
||||
): compiler.CompilationResult {
|
||||
const options: ts.CompilerOptions & HarnessOptions = compilerOptions ? ts.cloneCompilerOptions(compilerOptions) : { noResolve: false };
|
||||
options.target = ts.getEmitScriptTarget(options);
|
||||
options.newLine = options.newLine || ts.NewLineKind.CarriageReturnLineFeed;
|
||||
options.noErrorTruncation = true;
|
||||
options.skipDefaultLibCheck = typeof options.skipDefaultLibCheck === "undefined" ? true : options.skipDefaultLibCheck;
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
GetAccessorDeclaration,
|
||||
getEffectiveReturnTypeNode,
|
||||
getEffectiveTypeAnnotationNode,
|
||||
getEmitScriptTarget,
|
||||
getLanguageVariant,
|
||||
getLeadingCommentRanges,
|
||||
getNameOfDeclaration,
|
||||
@@ -350,7 +351,7 @@ export function provideInlayHints(context: InlayHintsContext): InlayHint[] {
|
||||
}
|
||||
|
||||
function leadingCommentsContainsParameterName(node: Node, name: string) {
|
||||
if (!isIdentifierText(name, compilerOptions.target, getLanguageVariant(file.scriptKind))) {
|
||||
if (!isIdentifierText(name, getEmitScriptTarget(compilerOptions), getLanguageVariant(file.scriptKind))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user