Skip to content

Port ES2025 ScriptTargetFeatures and fix ES2025 transformer mapping#2808

Merged
DanielRosenwasser merged 3 commits intomainfrom
copilot/port-es2025-target-features
Feb 17, 2026
Merged

Port ES2025 ScriptTargetFeatures and fix ES2025 transformer mapping#2808
DanielRosenwasser merged 3 commits intomainfrom
copilot/port-es2025-target-features

Conversation

Copy link
Contributor

Copilot AI commented Feb 17, 2026

Ports unported changes from microsoft/TypeScript#63046. The ES2025 target and lib declarations were already ported, but ScriptTargetFeatures entries and the transformer case were missing.

ScriptTargetFeatures (internal/checker/utilities.go)

Added missing entries to getFeatureMap:

  • New types: RegExpConstructor (es2025), Float16Array (es2025), ErrorConstructor (esnext), Uint8ArrayConstructor (esnext), DisposableStack (esnext), AsyncDisposableStack (esnext)
  • Moved esnext → es2025: Set methods (union, intersection, etc.), DataView Float16 methods, Math.f16round
  • New entries on existing types: PromiseConstructor.try (es2025), Intl members for es2020–es2025 (RelativeTimeFormat, Locale, DisplayNames, ListFormat, DateTimeFormat, Segmenter, DurationFormat)

ES2025 transformer (internal/transformers/estransforms/definitions.go)

Uncommented core.ScriptTargetES2025 in GetESTransformer. Previously ES2025 fell through to the default case, incorrectly applying ES2016-level downlevel transforms (e.g., optional chaining, spread → Object.assign).

Not ported

esnext.collection lib mapping change — the current submodule has lib.esnext.collection.d.ts with Map.getOrInsert methods still under esnext, so the mapping must stay as-is until the submodule is updated.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 17, 2026 19:27
- Add missing ScriptTargetFeatures entries in checker/utilities.go:
  - RegExpConstructor (es2025: escape)
  - Math (es2025: f16round)
  - Set methods moved from esnext to es2025
  - PromiseConstructor (es2025: try)
  - Intl (es2020-es2025 entries)
  - DataView (es2025: setFloat16, getFloat16)
  - Float16Array (es2025)
  - ErrorConstructor (esnext: isError)
  - Uint8ArrayConstructor (esnext: fromBase64, fromHex)
  - DisposableStack (esnext)
  - AsyncDisposableStack (esnext)
- Uncomment ES2025 in transformer definitions
- Accept baseline changes

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot AI changed the title [WIP] Port ES2025 target and add missing ScriptTargetFeatures Port ES2025 ScriptTargetFeatures and fix ES2025 transformer mapping Feb 17, 2026
Copilot AI requested a review from jakebailey February 17, 2026 19:39
case core.ScriptTargetESNext:
return nil // no transforms needed
case /*core.ScriptTargetES2025,*/ core.ScriptTargetES2024, core.ScriptTargetES2023, core.ScriptTargetES2022:
case core.ScriptTargetES2025, core.ScriptTargetES2024, core.ScriptTargetES2023, core.ScriptTargetES2022:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes, oops!

@jakebailey jakebailey marked this pull request as ready for review February 17, 2026 19:48
Copilot AI review requested due to automatic review settings February 17, 2026 19:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request ports missing ScriptTargetFeatures entries and fixes the ES2025 transformer mapping to align with TypeScript's ES2025 support. It addresses an issue where ES2025 code was incorrectly being downleveled using ES2016-era transformations.

Changes:

  • Added ES2025 and esnext ScriptTargetFeatures entries for new types and methods (RegExpConstructor, Float16Array, Set methods, Math.f16round, etc.)
  • Enabled ES2025 transformer case to prevent incorrect downlevel transforms
  • Updated test baselines to reflect correct ES2025 output (no downleveling of optional chaining and object spread)

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/transformers/estransforms/definitions.go Uncommented ES2025 case to apply correct transformer level
internal/checker/utilities.go Added ES2025/esnext feature map entries for new types and moved Set methods from esnext to es2025
testdata/baselines/reference/submodule/conformance/callChainWithSuper(target=es2025).js Updated baseline to show optional chaining is preserved (not downleveled)
testdata/baselines/reference/submodule/conformance/callChainWithSuper(target=es2025).js.diff Removed diff showing ES2025 now correctly preserves optional chaining
testdata/baselines/reference/compiler/declarationEmitQualifiedName.js Updated baseline to show object spread is preserved (not converted to Object.assign)

@DanielRosenwasser DanielRosenwasser added this pull request to the merge queue Feb 17, 2026
Merged via the queue into main with commit 3af079b Feb 17, 2026
26 checks passed
@DanielRosenwasser DanielRosenwasser deleted the copilot/port-es2025-target-features branch February 17, 2026 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants