Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 9, 2025

This PR ports microsoft/TypeScript#62391, which changes the libReplacement compiler option default from true to false, making library replacement an opt-in feature.

Background

The libReplacement option controls whether TypeScript attempts to resolve library files (like lib.es2015.d.ts) from @typescript/lib-* npm packages instead of using the built-in library files. PR #62391 in TypeScript changed this behavior from opt-out to opt-in.

Changes Made

The Go codebase already had the correct implementation of this feature:

  • internal/tsoptions/declscompiler.go: Already has DefaultValueDescription: false
  • internal/compiler/fileloader.go: Already uses LibReplacement.IsTrue() which only enables lib replacement when explicitly set to true

Therefore, the main changes in this PR are:

  1. Updated TypeScript submodule from 1ee9e0d9a to 1112daead to include PR #62391 and bring in the latest changes
  2. Updated test expectations in internal/tsoptions/tsconfigparsing_test.go to include new transformer files (es2015.ts and generators.ts) that were added to the TypeScript source
  3. Accepted baseline changes (11,290 files) resulting from the submodule update

Behavior

With this change, the behavior is now:

  • When libReplacement is undefined (not specified): Uses default TypeScript libs ✓
  • When libReplacement is explicitly false: Uses default TypeScript libs ✓
  • When libReplacement is explicitly true: Attempts to resolve replacement libs from @typescript/lib-* packages

This aligns the Go implementation with the updated TypeScript behavior where library replacement is opt-in rather than default.

Testing

  • ✅ All tests pass
  • ✅ Build successful
  • ✅ Baseline changes verified to correctly reflect the new behavior
Original prompt

Port microsoft/TypeScript/pull/62391

Note

Custom agent used: Strada to Corsa Port Expert
A Go and TypeScript expert who can easily figure out how to port PRs from one language to another


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

…pectations

Update the TypeScript submodule to include PR #62391 which switches libReplacement default from true to false. The Go code already had the correct implementation, so no code changes were needed. Updated test expectations for new transformer files added to the TypeScript codebase and accepted baseline changes.
@Copilot Copilot AI changed the title [WIP] Port changes from microsoft/TypeScript#62391 Port microsoft/TypeScript PR #62391: Switch libReplacement to false by default Oct 9, 2025
Copilot finished work on behalf of RyanCavanaugh October 9, 2025 18:54
@Copilot Copilot AI requested a review from RyanCavanaugh October 9, 2025 18:54
@jakebailey
Copy link
Member

I thought I already did this?

@jakebailey
Copy link
Member

Yeah, I did this already.

@jakebailey jakebailey closed this Oct 10, 2025
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