Repository navigation
typescript: type receivers from a generic signature's T and from Record/index-signature elements - #1730
Merged
Conversation
… Record/index-signature elements
A call's result was untyped when its type came from:
- a function-typed parameter with its own type parameter, bound from the
argument: `pick: <T>(x: T) => T; pick(u).save()`. Function-type parameters
never linked their declared type, so T had nothing to bind from;
- a signature's own `<T>` (function type, method/call/construct signature in a
type literal), which was not in scope for its return, so `T` referenced nothing;
- a `Record<K, V>` or inline `{ [k: string]: V }` read by key, including a value
that is itself a function type: `factories[kind](n).area()`.
Case 80 covers each shape plus controls that must stay unresolved
(`get<any>()`, an index signature over `any`).
Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com>
swapnilpaliwal-sd
requested review from
JaredHLZhang,
Whua689 and
suyashpaliwal26
as code owners
September 29, 2026 00:53
Merged
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.
A receiver typed by a generic signature's result was treated as untyped:
pick(u).save()throughpick: <T>(x: T) => T: function-type parameters now link their declared type, so T binds from the argument.<T>(function type, type-literal method/call/construct signature) is now in scope for its return.Record<K, V>and inline{ [k: string]: V }read by key type the element, including function-typed values (factories[kind](n).area()).container.get<Warrior>()andMap.getalready resolve when the library (the package, or the TypeScript lib) is passed with--library. They are known-missing in the client-only pass of the new case.Checked: new case 80 with controls that stay unresolved (
get<any>(), an index signature overany). TS suite 87/87 after blessing 13/73/79 (+1 correctRecordedge; 2 unresolved type uses of a signature'sTremoved; oracle precision 1.0). Parser tests 49/49. On a real handler-map app: known edges 5→7, unresolved 5→2.