-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db3575a
commit f244192
Showing
3 changed files
with
36 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
tests/baselines/reference/genericIndexedAccessVarianceComparisonResultCorrect.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
tests/cases/compiler/genericIndexedAccessVarianceComparisonResultCorrect.ts(25,1): error TS2322: Type 'T<A>' is not assignable to type 'T<B>'. | ||
Property 'z' is missing in type 'A' but required in type 'B'. | ||
|
||
|
||
==== tests/cases/compiler/genericIndexedAccessVarianceComparisonResultCorrect.ts (1 errors) ==== | ||
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; // should be true | ||
|
||
declare let a: T<A>; | ||
declare let b: T<B>; | ||
declare let c: C; | ||
declare let d: D; | ||
|
||
b = a; // should be no error | ||
~ | ||
!!! error TS2322: Type 'T<A>' is not assignable to type 'T<B>'. | ||
!!! error TS2322: Property 'z' is missing in type 'A' but required in type 'B'. | ||
!!! related TS2728 tests/cases/compiler/genericIndexedAccessVarianceComparisonResultCorrect.ts:8:5: 'z' is declared here. | ||
c = d; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters