Type of F<T>[keyof F<T>]
becomes unknown in TS 4.7.0-beta
#48626
Labels
Milestone
F<T>[keyof F<T>]
becomes unknown in TS 4.7.0-beta
#48626
Bug Report
I ran into this issue while testing my code with the new TS 4.7 beta. I didn't see anything in the breaking changes that looked related, so here's an issue!
🔎 Search Terms
🕗 Version & Regression Information
⏯ Playground Link
Playground Link: 4.7.0-dev showing the error and 4.6.2 not showing an error.
💻 Code
Output
Compiler Options
🙁 Actual behavior
This code fails to type check in TypeScript 4.7.0-beta:
It does pass the type checker in TS 4.6.2, as I believe it should.
🙂 Expected behavior
boundsForKey
should have a type ofBounds
and this should pass the type checker (as it does in TS 4.6.2).The type of
boundsForKey
is displayed asNumericBoundsOf<T>[keyof NumericBoundsOf<T>]
in both versions, but evidently TS 4.7.0-beta resolves this tounknown
whereas TS 4.6.2 resolved it toBounds
.The text was updated successfully, but these errors were encountered: