You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a bit confusing - the error message is auto-generated from the set of possible values that the parser knows about. Todayesnext and es2023 are the same value, so it doesn't realize it needs to print them back separately since they're not long-term semantically identical, so just arbitrarily prints one or the other and picks esnext
While we're at it, we should remove es3 from the printback list.
Aside: Now that I understand the ts error seen in VS Code comes from the actual parser, it becomes weird in VS Code that they both print warnings and capitalization is different.
But that is because VS Code shows both errors from the ts parser as well the json schema from the schemastore. But it always bugged me they are capitalized differently as seen above.
Even more confusing is that it is capitalized differently in your own TypeScript docs compared to the ts parser output:
I’ve always thought the all-lowercase variants were canonical, fwiw. I assume the camel-case versions probably originate from the TS source since there’s an enum for it. Though I guess ultimately the tsconfig parser doesn’t care about the capitalization.
Today esnext and es2023 are the same value
Wait, that doesn’t seem right. When I was working with the compiler API ESNext always had value 99 while all ES20xx were 0-based; there was never a case where one of them overlapped with ESNext. Has that changed?
Oh, I got messed up, ignore almost everything up there. OP is confusing lib and target -- es2023 is a valid lib, but isn't a valid target because there's nothing different between es2022 and es2023 re: syntax
Since target changes default value of lib, if I have "target": "es2022" then it cannot have "lib": "es2023 I assume, meaning I need to change lib manually?
Having Googled and looked around, there is a large amount of confusion around these settings as seen by SO questions etc.
Could the above target lib then be more specific exactly what it aims to "downlevel"?
New runtime methods (i.e. things that can be polyfilled) are not syntactic features.
Ryan Cavanaugh (@RyanCavanaugh) By what definition? The top 10 Google results for javascript es6 features give e.g. Array.from() in a list of "ES features". A problem is how target is documented. There are many, many sites with headlines similar to "ecmascript features" that then goes about listing APIs. Even Node.js on release note blog post does this as an example, see https://nodejs.org/en/blog/announcements/v18-release-announce
the following new features are included ... The findLast() and findLastIndex() array methods.
Regarding:
You can. Did you try it?
I did try. But the core of the problem is this:
Changing target also changes the default value of lib.
I would suspect many users e.g. know they want to support es2023. Then they might go about their day and just set "target": "es2022" since they noticed that es2023 is not a valid option. But they might then forget to set "lib": ["es2023"].
Why not just include "target": "es2023" even if nothing new is happen, since that could then also change the default lib? Does that not make a lot of sense?
I could try to submit a PR to improve the docs of target if ok? Ideally though as well I feel es2023 should be part of the targets due to above mentioned reasons.
Activity
RyanCavanaugh commentedon Nov 3, 2023
This is a bit confusing - the error message is auto-generated from the set of possible values that the parser knows about. Today
esnextandes2023are the same value, so it doesn't realize it needs to print them back separately since they're not long-term semantically identical, so just arbitrarily prints one or the other and picksesnextWhile we're at it, we should remove
es3from the printback list.thernstig commentedon Nov 3, 2023
Ryan Cavanaugh (@RyanCavanaugh) note there are two bugs then. The error message from the parser + the docs issue on https://www.typescriptlang.org/tsconfig.
Aside: Now that I understand the ts error seen in VS Code comes from the actual parser, it becomes weird in VS Code that they both print warnings and capitalization is different.
But that is because VS Code shows both errors from the ts parser as well the json schema from the schemastore. But it always bugged me they are capitalized differently as seen above.
Even more confusing is that it is capitalized differently in your own TypeScript docs compared to the ts parser output:
fatcerberus commentedon Nov 3, 2023
I’ve always thought the all-lowercase variants were canonical, fwiw. I assume the camel-case versions probably originate from the TS source since there’s an enum for it. Though I guess ultimately the tsconfig parser doesn’t care about the capitalization.
Wait, that doesn’t seem right. When I was working with the compiler API
ESNextalways had value 99 while allES20xxwere 0-based; there was never a case where one of them overlapped withESNext. Has that changed?RyanCavanaugh commentedon Nov 3, 2023
Oh, I got messed up, ignore almost everything up there. OP is confusing
libandtarget--es2023is a valid lib, but isn't a valid target because there's nothing different between es2022 and es2023 re: syntaxthernstig commentedon Nov 5, 2023
Ryan Cavanaugh (@RyanCavanaugh) it could be labeled as confusion, but frankly how would one know reading this?
https://www.typescriptlang.org/tsconfig#target
Array.prototype.findLast()andArray.prototype.findLastIndex()(Add Array.prototype.findLast() and Array.prototype.findLastIndex() #49636) not count as features? And thus do not need to be "downleveled"?targetchanges default value oflib, if I have"target": "es2022"then it cannot have"lib": "es2023I assume, meaning I need to changelibmanually?Having Googled and looked around, there is a large amount of confusion around these settings as seen by SO questions etc.
Could the above
targetlib then be more specific exactly what it aims to "downlevel"?RyanCavanaugh commentedon Nov 6, 2023
New runtime methods (i.e. things that can be polyfilled) are not syntactic features.
You can. Did you try it?
thernstig commentedon Nov 7, 2023
Ryan Cavanaugh (@RyanCavanaugh) By what definition? The top 10 Google results for
javascript es6 featuresgive e.g.Array.from()in a list of "ES features". A problem is howtargetis documented. There are many, many sites with headlines similar to "ecmascript features" that then goes about listing APIs. Even Node.js on release note blog post does this as an example, see https://nodejs.org/en/blog/announcements/v18-release-announceRegarding:
I did try. But the core of the problem is this:
I would suspect many users e.g. know they want to support
es2023. Then they might go about their day and just set"target": "es2022"since they noticed thates2023is not a valid option. But they might then forget to set"lib": ["es2023"].Why not just include
"target": "es2023"even if nothing new is happen, since that could then also change the default lib? Does that not make a lot of sense?I could try to submit a PR to improve the docs of
targetif ok? Ideally though as well I feeles2023should be part of the targets due to above mentioned reasons.RyanCavanaugh commentedon Nov 7, 2023
I'm trying to give you a definition. A new method is not a syntax.
Doc improvements always welcomed.
typescript-bot commentedon Nov 10, 2023
This issue has been marked as "Question" and has seen no recent activity. It has been automatically closed for house-keeping purposes.
thernstig commentedon Nov 10, 2023
I will give it a try soon.