Extends Constraints
In 4.7 TypeScript added support for inlining an extends clause
in a conditional type. This can help reduce the complexity of
conditional types.
If you're new to conditional types see: example:conditional-types
As an example, here is a 4.6 conditional type which looks
at the return value of a function and only returns a type
if the return type is a string.
prettier-ignore
// It's essentially two if statements, one for the return type
and one then to check if the return type is a string. In
4.7 this can be done inside one statement.
prettier-ignore
type ReturnTypeOnlyStrings47
// It's a little like being able to use an && inside the conditional
type check, which makes code a bit simpler and more readable.
type ReturnType2