Microsoft notes some limits to the feature. Special checking, for instance, only happens when a single parameter is associated with the type being checked against in a conditional type or used as a key in an indexed access type. When using a conditional type, at least two checks must exist, with a terminal branch including never
. The parameter’s type has to be generic and be constrained by a union type. Overall, checks will not occur when a specific type is associated with type parameter.
With TypeScript 5.8, developers will not have to wait long for a general availability, according to the release schedule. A release candidate is due February 11 and the final release is due to arrive February 25. TypeScript 5.8 follows the release of TypeScript 5.7 in November, which featured improved error reporting.
Other features planned for TypeScript 5.8 include the following: