The different subtype error is usually caused by two mistakes:
- Providing a default value which might not be specific enough.
function broke<T extends string>(x: T = "error"): T { return x }
// ^^^^^^^^^^^^^^
// Type 'string' is not assignable to type 'T'.
// 'string' is assignable to the constraint of type 'T', but
// 'T' could be instantiated with a different subtype of
// constraint 'string'.