-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed
Description
TypeScript Version: 3.7.2, also tested in nightly (3.8.0-dev.20191224)
Search Terms:
"is assignable to the constraint of type", "could be instantiated with a different subtype of constraint"
Code
function test<T extends {accepted: boolean}>(cb: (value: T) => void) {
return (data: Omit<T, 'accepted'>) => cb({...data, accepted: true});
}
Expected behavior:
No error
Actual behavior:
Argument of type 'Pick<T, Exclude<keyof T, "accepted">> & { accepted: true; }' is not assignable to parameter of type 'T'.
'Pick<T, Exclude<keyof T, "accepted">> & { accepted: true; }' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{ accepted: boolean; }'.
Related Issues:
prannayb, hbu50, jdt3969, dwjohnston, foxhatleo and 18 more
Metadata
Metadata
Assignees
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed