Regression: Indexed Access of Partial Mapped Type with Union from Generic Function is missing undefined
#57487
Labels
Bug
A bug in TypeScript
undefined
#57487
🔎 Search Terms
generic function, partial, optional, mapped type, indexed access, undefined, bug, regression
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play?target=99&jsx=0&pretty=true&ts=4.6.2#code/C4TwDgpgBA8gRgKygXigbwFBW1AhgLigEYAaLHOQgJgwF8BuDDAYwHsA7AZ2CgFtcwkACaFMOKAG0A0lACW7KAGsIIVgDMoABVwAnYLNwAbADzwEAPgC6hM9Mt0U6WkzZceOiJ1aGAbhACyAsKOxjIQAB7AEOxCnEoq6lCgkIn8ghBC5gAUyiCEUgCUKOZ8QRkSuZYAdMCsAMrAOvIA5lkFjAD0HVAAegC0fVAAojo6rDpQEZDMUUJQWQAGacIVKpYLcnFgrJycsnCGIFAArjEQavIZBRhAA
💻 Code
🙁 Actual behavior
TypeScript does not recognize
mapper[key]
might be undefined and emits broken code without errors🙂 Expected behavior
Correct type inference from pre-v4.6.x
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: