-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone
Milestone
Description
Bug Report
🔎 Search Terms
generic
unassignable type
uncomputed type
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about:
⏯ Playground Link
Playground link with relevant code
💻 Code
class A {
x: string = 'A';
y: number = 0;
}
class B {
x: string = 'B';
z: boolean = true;
}
type T<X extends { x: any }> = Pick<X, 'x'>;
type C = T<A>;
type D = T<B>;
type C_extends_D = C extends D ? true : false; // true
type PickA_extends_PickB = Pick<A, 'x'> extends Pick<B, 'x'> ? true : false; // true
type TA_extends_TB = T<A> extends T<B> ? true : false; // false (?)
declare let a: T<A>;
declare let b: T<B>;
declare let c: C;
declare let d: D;
b = a; // error here (?)
c = d;
🙁 Actual behavior
- Type
TA_extends_TB
isfalse
. a
is not assignable tob
.
🙂 Expected behavior
- All types
TA_extends_TB
should betrue
, the same way asC_extends_D
andPickA_extends_PickB
. a
should be assignable tob
and vice-versa, the same way asc
andd
.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone