File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ tests/cases/compiler/nonIdenticalTypeConstraints.ts(10,11): error TS2428: All declarations must have identical type parameters.
2+ tests/cases/compiler/nonIdenticalTypeConstraints.ts(16,7): error TS2428: All declarations must have identical type parameters.
3+ tests/cases/compiler/nonIdenticalTypeConstraints.ts(36,11): error TS2428: All declarations must have identical type parameters.
4+
5+
6+ ==== tests/cases/compiler/nonIdenticalTypeConstraints.ts (3 errors) ====
7+ class Different {
8+ a: number;
9+ b: string;
10+ c: boolean;
11+ }
12+
13+ class Foo<T extends Function> {
14+ n: T;
15+ }
16+ interface Foo<T extends Different> {
17+ ~~~
18+ !!! error TS2428: All declarations must have identical type parameters.
19+ y: T;
20+ }
21+ interface Qux<T extends Different> {
22+ y: T;
23+ }
24+ class Qux<T extends Function> {
25+ ~~~
26+ !!! error TS2428: All declarations must have identical type parameters.
27+ n: T;
28+ }
29+
30+ class Bar<T extends Function> {
31+ n: T;
32+ }
33+ interface Bar<T extends Function> {
34+ y: T;
35+ }
36+ interface Baz<T extends Function> {
37+ y: T;
38+ }
39+ class Baz<T extends Function> {
40+ n: T;
41+ }
42+
43+ class Quux<T> {
44+ n: T;
45+ }
46+ interface Quux<U> {
47+ ~~~~
48+ !!! error TS2428: All declarations must have identical type parameters.
49+ m: U;
50+ }
Original file line number Diff line number Diff line change 1+ //// [nonIdenticalTypeConstraints.ts]
2+ class Different {
3+ a : number ;
4+ b : string ;
5+ c : boolean ;
6+ }
7+
8+ class Foo < T extends Function > {
9+ n : T ;
10+ }
11+ interface Foo < T extends Different > {
12+ y : T ;
13+ }
14+ interface Qux < T extends Different > {
15+ y : T ;
16+ }
17+ class Qux < T extends Function > {
18+ n : T ;
19+ }
20+
21+ class Bar < T extends Function > {
22+ n : T ;
23+ }
24+ interface Bar < T extends Function > {
25+ y : T ;
26+ }
27+ interface Baz < T extends Function > {
28+ y : T ;
29+ }
30+ class Baz < T extends Function > {
31+ n : T ;
32+ }
33+
34+ class Quux < T > {
35+ n : T ;
36+ }
37+ interface Quux < U > {
38+ m : U ;
39+ }
40+
41+ //// [nonIdenticalTypeConstraints.js]
42+ var Different = ( function ( ) {
43+ function Different ( ) {
44+ }
45+ return Different ;
46+ } ( ) ) ;
47+ var Foo = ( function ( ) {
48+ function Foo ( ) {
49+ }
50+ return Foo ;
51+ } ( ) ) ;
52+ var Qux = ( function ( ) {
53+ function Qux ( ) {
54+ }
55+ return Qux ;
56+ } ( ) ) ;
57+ var Bar = ( function ( ) {
58+ function Bar ( ) {
59+ }
60+ return Bar ;
61+ } ( ) ) ;
62+ var Baz = ( function ( ) {
63+ function Baz ( ) {
64+ }
65+ return Baz ;
66+ } ( ) ) ;
67+ var Quux = ( function ( ) {
68+ function Quux ( ) {
69+ }
70+ return Quux ;
71+ } ( ) ) ;
Original file line number Diff line number Diff line change 1+ class Different {
2+ a : number ;
3+ b : string ;
4+ c : boolean ;
5+ }
6+
7+ class Foo < T extends Function > {
8+ n : T ;
9+ }
10+ interface Foo < T extends Different > {
11+ y : T ;
12+ }
13+ interface Qux < T extends Different > {
14+ y : T ;
15+ }
16+ class Qux < T extends Function > {
17+ n : T ;
18+ }
19+
20+ class Bar < T extends Function > {
21+ n : T ;
22+ }
23+ interface Bar < T extends Function > {
24+ y : T ;
25+ }
26+ interface Baz < T extends Function > {
27+ y : T ;
28+ }
29+ class Baz < T extends Function > {
30+ n : T ;
31+ }
32+
33+ class Quux < T > {
34+ n : T ;
35+ }
36+ interface Quux < U > {
37+ m : U ;
38+ }
You can’t perform that action at this time.
0 commit comments