-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
Bug Report
π Search Terms
variance, conditional, subtype, limit
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about variance and conditionals.
β― Playground Link
Playground link with relevant code
π» Code
interface Base {
base: unknown;
}
interface Sub extends Base {
sub: unknown;
}
function transform<T extends Base>(t: T): T extends Sub ? Sub : T {
return t;
}π Actual behavior
"Type 'T' is not assignable to type 'T extends Sub ? Sub : T'."
π Expected behavior
No errors. Either T extends Sub, and so is assignable to it, or it doesn't, and so is assignable to itself.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created