Skip to content

Conversation

jakebailey
Copy link
Member

Ports microsoft/TypeScript#61668.

I am not 100% sure this is correct. Might need @ahejlsberg to attempt it.

Copy link
Contributor

@Copilot 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 PR ports TypeScript PR #61668, which fixes type variable leaks and cache inconsistencies in generic type inference. The changes focus on improving how type parameters are handled in signature instantiation to prevent incorrect type variable leakage between different inference contexts.

Key Changes:

  • Simplified single signature type handling by removing the separate SingleSignatureType struct and treating these as anonymous types
  • Enhanced outer return type mapping to prevent circular inferences and type parameter leaks
  • Improved type mapper creation for better isolation of type parameters across inference contexts

Reviewed Changes

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

Show a summary per file

:

File Description
internal/checker/types.go Removed SingleSignatureType struct and simplified type handling
internal/checker/checker.go Modified signature instantiation logic and added outer return mapper functionality
internal/checker/inference.go Added createOuterReturnMapper function for better type parameter isolation
internal/checker/nodebuilderimpl.go Updated function call to remove outer type parameters parameter
internal/checker/jsx.go Updated JSX signature creation calls to match new API
internal/testrunner/compiler_runner.go Removed test skip for now-working inference test
testdata/baselines/reference/submodule/compiler/*.types Updated type inference test baselines showing improved behavior

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.

1 participant