Introduce ES2025 target & Add missing ScriptTargetFeatures#63046
Introduce ES2025 target & Add missing ScriptTargetFeatures#63046petamoriken wants to merge 18 commits intomicrosoft:mainfrom
Conversation
|
Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping @sheetalkamat, @mjbvz, and @joj for you. Feel free to loop in other consumers/maintainers if necessary. |
|
Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page. Also, please make sure @DanielRosenwasser and @RyanCavanaugh are aware of the changes, just as a heads up. |
|
Can we please get this reviewed? I know the country is burning and everyone is being replaced by AI but this would be really useful for those of us who deal with audiences across different languages. |
|
We have a lot of these lib related PRs; it's absolutely our intention to review all of them as soon as we can, we've just had a bunch of other stuff that has been a bit more pressing. |
|
I will note that an all-up PR for this may not be as useful as us reviewing the individual esnext PRs and then having a dedicated ES2025 PR; them being mixed together in this PR is making it hard to figure out what's new and what's just moving around. I would have preferred that the other PRs not be closed and this PR be a pure move + define options. |
|
Only two files were newly added: es2025.intl.d.ts and es2025.regexp.d.ts. I created this combined PR because the individual "esnext" PRs for these features had stalled, and there had been no progress. I wanted to take over the tasks myself, and since there are only two added files, I thought the review would not be too difficult. @jakebailey If you still prefer to have them separated, I can create two individual PRs instead. What do you think? |
Co-authored-by: lionel-rowe <lionel.rowe@gmail.com>
Co-authored-by: 김상두 <puki4416@gmail.com>
9d68792 to
86c687a
Compare
|
@jakebailey For now, I can remove the additions of es2025.intl.d.ts and es2025.regexp.d.ts from this PR, but should I do so? Please let me know your thoughts. |
|
@typescript-bot test it |
.../reference/tsbuild/commandLine/multiFile/different-options-with-incremental-discrepancies.js
Outdated
Show resolved
Hide resolved
|
This PR looks largely correct, though I am confused by some of the test baseline changes. I think it might be fine to take this first and then fix the other lib updates depending on what's in ES2025. |
| ["esnext.array", "lib.esnext.array.d.ts"], | ||
| ["esnext.decorators", "lib.esnext.decorators.d.ts"], | ||
| ["esnext.disposable", "lib.esnext.disposable.d.ts"], | ||
| ["esnext.error", "lib.esnext.error.d.ts"], | ||
| ["esnext.intl", "lib.esnext.intl.d.ts"], | ||
| ["esnext.sharedmemory", "lib.esnext.sharedmemory.d.ts"], | ||
| ["esnext.typedarrays", "lib.esnext.typedarrays.d.ts"], |
There was a problem hiding this comment.
Are none of these applicable to ES2025?
There was a problem hiding this comment.
Yes.
- esnext.array.d.ts
- ES2026 Array.fromAsync
- esnext.decorators.d.ts
- Stage 3 Decorator Metadata
- esnext.disposable.d.ts
- Stage 3 Explicit Resource Management
- esnext.error.d.ts
- ES2026 Error.isError
- esnext.intl.d.ts
- Originally, only the
Intlnamespace was written, and I have not touched this file.
declare namespace Intl { // Empty }
- Originally, only the
- esnext.sharedmemory.d.ts
- Stage 3 Atomics.pause
- esnext.typedarrays.d.ts
- ES2026 Uint8Array to/from Base64
ref: https://github.com/tc39/proposals/blob/main/finished-proposals.md
|
@jakebailey Here are the results of running the user tests with tsc comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
|
Hey @jakebailey, the results of running the DT tests are ready. Everything looks the same! |
|
@jakebailey Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@jakebailey Here are the results of running the top 400 repos with tsc comparing Everything looks good! |
|
This PR is missing an update to |
jakebailey
left a comment
There was a problem hiding this comment.
Overall I think this is fine, but needs that lib file switch case update.
| /// <reference lib="webworker.importscripts" /> | ||
| /// <reference lib="scripthost" /> | ||
| /// <reference lib="dom.iterable" /> | ||
| /// <reference lib="dom.asynciterable" /> |
There was a problem hiding this comment.
This is not strictly required anymore (for any of the libs), but not a problem in this PR; can be cleaned up later.
There was a problem hiding this comment.
My main concern with this file is the defined unions they don't entirely match the pattern of inlining things like in existing intl or the original es5 types.
jakebailey
left a comment
There was a problem hiding this comment.
Some other stuff I noticed.
src/lib/es2025.intl.d.ts
Outdated
|
|
||
| type DurationFormatUnitSingular = | ||
| | "year" | ||
| | "quarter" |
src/lib/es2025.intl.d.ts
Outdated
| locale?: UnicodeBCP47LocaleIdentifier; | ||
| numberingSystem?: DateTimeFormatOptions["numberingSystem"]; | ||
| style?: DurationFormatStyle; | ||
| years?: Exclude<DurationFormatOption, "numeric" | "2-digit">; | ||
| yearsDisplay?: DurationFormatDisplayOption; | ||
| months?: Exclude<DurationFormatOption, "numeric" | "2-digit">; | ||
| monthsDisplay?: DurationFormatDisplayOption; | ||
| weeks?: Exclude<DurationFormatOption, "numeric" | "2-digit">; | ||
| weeksDisplay?: DurationFormatDisplayOption; | ||
| days?: Exclude<DurationFormatOption, "numeric" | "2-digit">; | ||
| daysDisplay?: DurationFormatDisplayOption; | ||
| hours?: DurationFormatOptions; | ||
| hoursDisplay?: DurationFormatDisplayOption; | ||
| minutes?: DurationFormatOptions; | ||
| minutesDisplay?: DurationFormatDisplayOption; | ||
| seconds?: DurationFormatOptions; | ||
| secondsDisplay?: DurationFormatDisplayOption; | ||
| milliseconds?: DurationFormatOptions; | ||
| millisecondsDisplay?: DurationFormatDisplayOption; | ||
| microseconds?: DurationFormatOptions; | ||
| microsecondsDisplay?: DurationFormatDisplayOption; | ||
| nanoseconds?: DurationFormatOptions; | ||
| nanosecondsDisplay?: DurationFormatDisplayOption; | ||
| fractionalDigits?: fractionalDigitsOption; |
There was a problem hiding this comment.
These options don't appear to be resolved; I think they should omit the ?.
|
I am actually quite confused why these intl changes are in ES2025. Doesn't https://github.com/tc39/proposal-intl-duration-format imply they are ES2024? |
|
I think I'm just wrong; it's in https://tc39.es/ecma402/2025/ but not https://tc39.es/ecma402/2024/. |
src/lib/es2025.intl.d.ts
Outdated
| | "day" | ||
| | "hour" | ||
| | "minute" | ||
| | "second"; |
There was a problem hiding this comment.
I think this also needs milliseconds, microseconds, nanoseconds
src/lib/es2025.intl.d.ts
Outdated
| minutesDisplay?: DurationFormatDisplayOption; | ||
| seconds?: DurationFormatOptions; | ||
| secondsDisplay?: DurationFormatDisplayOption; | ||
| milliseconds?: DurationFormatOptions; |
There was a problem hiding this comment.
For milliseconds, microseconds, nanoseconds (not display), I think they need to be Exclude<DurationFormatOption, "2-digit"> (and below)
|
I realize I dumped a bunch of changes onto you; if you are too busy, I'm happy to just push the intl changes to the PR directly. |
|
Instead of adding a new |
| microsecondsDisplay: "always" | "auto"; | ||
| nanoseconds: "long" | "short" | "narrow" | "numeric"; | ||
| nanosecondsDisplay: "always" | "auto"; | ||
| fractionalDigits?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9; |
There was a problem hiding this comment.
According to the spec, this fractionalDigits property seems to be optional in the return value of resolvedOptions. I tested the behavior in Chrome and Firefox, and the property was non-existent when it was undefined.
| @@ -0,0 +1,135 @@ | |||
| /// <reference lib="es2018.intl" /> | |||
There was a problem hiding this comment.
I added this because NumberFormatPartTypes is being used within the file.
I have fixed most of it on my end. If the release of TypeScript 6.0 is imminent and you need the changes reflected immediately, please feel free to push directly to the PR 🙇 |
|
It seems that in es2023.intl.d.ts ( |
Fixes #61735
This PR includes the addition of 2 type files:
Related issues and (stalled) PRs
ES2025
RegExp.escape(es2025.regexp.d.ts)Closes #61321
Closes #62138
ES2025
Intl.DurationFormat(es2025.intl.d.ts)Closes #60608
Closes #60646