-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Ensure harness doesn't force or eagerly computes target
, stop using raw target
elsewhere
#57526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
if (compilerOptions.newLine === undefined) compilerOptions.newLine = ts.NewLineKind.CarriageReturnLineFeed; | ||
if (compilerOptions.skipDefaultLibCheck === undefined) compilerOptions.skipDefaultLibCheck = true; | ||
if (compilerOptions.noErrorTruncation === undefined) compilerOptions.noErrorTruncation = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to say that we should drop these too, but:
- If we change the default
newLine
, all baselines will change from CRLF to LF and lose git history. skipDefaultLibCheck
is a perf optimization.noErrorTruncation
gives us better baselines.
@@ -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))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems quite easy to make this kind of error; I am tempted to write an eslint rule which disallows the use of any CompilerOption property that we know to be computed, but that is non-trivial.
@@ -18,6 +18,136 @@ | |||
"File '/lib/cjs/index.tsx' does not exist.", | |||
"File '/lib/cjs/index.d.ts' exists - use it as a name resolution result.", | |||
"======== Module name '../lib' was successfully resolved to '/lib/cjs/index.d.ts'. ========", | |||
"======== Resolving module '@typescript/lib-esnext' from '/.src/__lib_node_modules_lookup_lib.esnext.d.ts__.ts'. ========", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this baseline change to be correct; this test would (outside of the test harness) have an implicit target of esnext
, but we were forcing it to be es5.
@@ -1,13 +1,8 @@ | |||
error TS2468: Cannot find global value 'Promise'. | |||
/src/bar.cts(2,1): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another example of the implicit module setting now being reflected in tests; this was defaulted to ES5, but now it's esnext.
Pulled out of #57525 to make that change less noisy.
target
in certain conditions; this had the affect of making some tests not test the implicit target controlled by themodule
option.target
; eagerly computing it had the affect of making our nice "this setting is dead, please remove" tests not work (because a change like Remove target=es3 #57525 would changetarget
from ES3 into ES5 at use).target
directly, when they should have been using the computed target.