Repository navigation
Add instantiated symbol mapper into context mapper when reprinting nodes we instantiate before printing - #64680
Open
Wesley Wigham (weswigham) wants to merge 1 commit into
Conversation
…des we instantiate
Wesley Wigham (weswigham)
requested review from
Gabriela Araujo Britto (gabritto) and
Jake Bailey (jakebailey)
and
a balanced review from Copilot
October 7, 2026 22:50
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Mapper self-composition can over-instantiate types, and the regression test does not reproduce the linked issue’s required signature shape.
2 open findings
What changed in this PR
Fixes declaration emit leaking uninstantiated type parameters by propagating symbol mappers during type-node serialization.
Changes:
- Composes instantiated-symbol mappers into node-builder context.
- Adds compiler and transpile regression coverage.
- Updates affected type and declaration baselines.
| File | Description |
|---|---|
tsc/internal/checker/nodebuilderimpl.go |
Propagates instantiated-symbol mappers. |
tsc/internal/checker/pseudotypenodebuilder.go |
Falls back when direct nodes require mapping. |
tsc/testdata/tests/cases/compiler/declarationEmitUninstantiatedConditionalTypeParameters.ts |
Adds declaration-emit regression test. |
tsc/testdata/tests/cases/transpile/declarationEmitUnresolvedGenericAnnotations.ts |
Tests unresolved generic annotations. |
tsc/testdata/baselines/reference/transpile/declarationEmitUnresolvedGenericAnnotations.d.ts |
Records transpile declaration output. |
tsc/testdata/baselines/reference/compiler/declarationEmitUninstantiatedConditionalTypeParameters.js |
Records declaration emit. |
tsc/testdata/baselines/reference/compiler/declarationEmitUninstantiatedConditionalTypeParameters.symbols |
Records symbol output. |
tsc/testdata/baselines/reference/compiler/declarationEmitUninstantiatedConditionalTypeParameters.types |
Records inferred types. |
tsc/testdata/baselines/reference/compiler/declarationsWithRecursiveInternalTypesProduceUniqueTypeParams.types |
Updates recursive-type output. |
tsc/testdata/baselines/reference/compiler/es2018ObjectAssign.types |
Updates union ordering. |
tsc/testdata/baselines/reference/conformance/usePromiseFinally(target=es2015).types |
Updates Promise type ordering. |
tsc/testdata/baselines/reference/conformance/parserRealSource8.types |
Updates instantiated method display. |
tsc/testdata/baselines/reference/conformance/parserRealSource14.types |
Updates instantiated array method display. |
🧠 Review effort: Balanced
Comment on lines
+2305
to
+2307
| if symbol != nil && symbol.CheckFlags&ast.CheckFlagsInstantiated != 0 { | ||
| b.ctx.mapper = b.ch.combineTypeMappers(b.ch.valueSymbolLinks.Get(symbol).mapper, oldMapper) | ||
| } |
Comment on lines
+13
to
+14
| interface Builder<TOutputOut> { | ||
| query<T>(resolver: () => T): { output: TOutputOut extends "unset" ? T : TOutputOut }; |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fixes #64614
The instantiated symbol mapper from the inferred
querycall wasn't being included in the type we were serializing, so we producing uninstantiated type parameters. By merging it into the node builder context mapper, it correctly propagates down into the nodes we try and serialize for the return type for that signature (...and in turn evaluates it, producing a follow-onanyfrom the missing import, but the project hasnoImplicitAny: falseso what are you gonna do)