You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Indexed accesses like this are never used as inference sources - the information at this location is at best partial information for what T can be. That said, there is an open PR that would make this inference work: #53017
You can just infer into the whole T like this: TS playground
Or you can rewrite this signature using reverse-mapped types: TS playground
Using the technique above you can even benefit from excess property check in the upcoming TS 5.4: TS playground
🔎 Search Terms
Generic derivation
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play?ts=5.3.3#code/C4TwDgpgBAggdiAShAxgewE4BMoF4rLrYA8AzsBgJZwDmANFAIYIB8A3AFCiRQBmceKMQAqUCAA9gEOFlJQA3kwBcsBIUw4AviwAUYRhkYBbUisWMVwgNoAiRjYC6UTQEo8LKNbuPOHdHHIoACMVfkE9A2NSN1wPeQ4oRKgMCGAAVwwBfUMTADpGDk1ff0CUQSCdeMSLBQSkxgBGFQaAJgBmOjrNTtdOIA
💻 Code
🙁 Actual behavior
Why isn't c deduced to the type I actually passed in?
🙂 Expected behavior
c is deduced to the type I actually passed in
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: