The next TypeScript compiler update will be exciting!
PR #56941 by @gabritto.bsky.social improves support for conditional and indexed access types as return types, enabling proper typing for functions like the one in the snippet without clunky hacks or dubious overloads.
The next TypeScript compiler update will be exciting!
PR #56941 by @gabritto.bsky.social improves support for conditional and indexed access types as return types, enabling proper typing for functions like the one in the snippet without clunky hacks or dubious overloads.
Immediate access in the realm of values is not deferred, but `to` has a type param as type so TS can only resort to its constraint. OTOH in the realm of types `T["property"]` stays deferred, so indirect access is well typed.
@andarist.bsky.social highlight of the day from our chat
Immediate access in the realm of values is not deferred, but `to` has a type param as type so TS can only resort to its constraint. OTOH in the realm of types `T["property"]` stays deferred, so indirect access is well typed.
@andarist.bsky.social highlight of the day from our chat