mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
parent
e46b7b05ab
commit
eacc092f87
@ -0,0 +1,50 @@
|
||||
tests/cases/compiler/nonIdenticalTypeConstraints.ts(10,11): error TS2428: All declarations must have identical type parameters.
|
||||
tests/cases/compiler/nonIdenticalTypeConstraints.ts(16,7): error TS2428: All declarations must have identical type parameters.
|
||||
tests/cases/compiler/nonIdenticalTypeConstraints.ts(36,11): error TS2428: All declarations must have identical type parameters.
|
||||
|
||||
|
||||
==== tests/cases/compiler/nonIdenticalTypeConstraints.ts (3 errors) ====
|
||||
class Different {
|
||||
a: number;
|
||||
b: string;
|
||||
c: boolean;
|
||||
}
|
||||
|
||||
class Foo<T extends Function> {
|
||||
n: T;
|
||||
}
|
||||
interface Foo<T extends Different> {
|
||||
~~~
|
||||
!!! error TS2428: All declarations must have identical type parameters.
|
||||
y: T;
|
||||
}
|
||||
interface Qux<T extends Different> {
|
||||
y: T;
|
||||
}
|
||||
class Qux<T extends Function> {
|
||||
~~~
|
||||
!!! error TS2428: All declarations must have identical type parameters.
|
||||
n: T;
|
||||
}
|
||||
|
||||
class Bar<T extends Function> {
|
||||
n: T;
|
||||
}
|
||||
interface Bar<T extends Function> {
|
||||
y: T;
|
||||
}
|
||||
interface Baz<T extends Function> {
|
||||
y: T;
|
||||
}
|
||||
class Baz<T extends Function> {
|
||||
n: T;
|
||||
}
|
||||
|
||||
class Quux<T> {
|
||||
n: T;
|
||||
}
|
||||
interface Quux<U> {
|
||||
~~~~
|
||||
!!! error TS2428: All declarations must have identical type parameters.
|
||||
m: U;
|
||||
}
|
||||
71
tests/baselines/reference/nonIdenticalTypeConstraints.js
Normal file
71
tests/baselines/reference/nonIdenticalTypeConstraints.js
Normal file
@ -0,0 +1,71 @@
|
||||
//// [nonIdenticalTypeConstraints.ts]
|
||||
class Different {
|
||||
a: number;
|
||||
b: string;
|
||||
c: boolean;
|
||||
}
|
||||
|
||||
class Foo<T extends Function> {
|
||||
n: T;
|
||||
}
|
||||
interface Foo<T extends Different> {
|
||||
y: T;
|
||||
}
|
||||
interface Qux<T extends Different> {
|
||||
y: T;
|
||||
}
|
||||
class Qux<T extends Function> {
|
||||
n: T;
|
||||
}
|
||||
|
||||
class Bar<T extends Function> {
|
||||
n: T;
|
||||
}
|
||||
interface Bar<T extends Function> {
|
||||
y: T;
|
||||
}
|
||||
interface Baz<T extends Function> {
|
||||
y: T;
|
||||
}
|
||||
class Baz<T extends Function> {
|
||||
n: T;
|
||||
}
|
||||
|
||||
class Quux<T> {
|
||||
n: T;
|
||||
}
|
||||
interface Quux<U> {
|
||||
m: U;
|
||||
}
|
||||
|
||||
//// [nonIdenticalTypeConstraints.js]
|
||||
var Different = (function () {
|
||||
function Different() {
|
||||
}
|
||||
return Different;
|
||||
}());
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
}());
|
||||
var Qux = (function () {
|
||||
function Qux() {
|
||||
}
|
||||
return Qux;
|
||||
}());
|
||||
var Bar = (function () {
|
||||
function Bar() {
|
||||
}
|
||||
return Bar;
|
||||
}());
|
||||
var Baz = (function () {
|
||||
function Baz() {
|
||||
}
|
||||
return Baz;
|
||||
}());
|
||||
var Quux = (function () {
|
||||
function Quux() {
|
||||
}
|
||||
return Quux;
|
||||
}());
|
||||
38
tests/cases/compiler/nonIdenticalTypeConstraints.ts
Normal file
38
tests/cases/compiler/nonIdenticalTypeConstraints.ts
Normal file
@ -0,0 +1,38 @@
|
||||
class Different {
|
||||
a: number;
|
||||
b: string;
|
||||
c: boolean;
|
||||
}
|
||||
|
||||
class Foo<T extends Function> {
|
||||
n: T;
|
||||
}
|
||||
interface Foo<T extends Different> {
|
||||
y: T;
|
||||
}
|
||||
interface Qux<T extends Different> {
|
||||
y: T;
|
||||
}
|
||||
class Qux<T extends Function> {
|
||||
n: T;
|
||||
}
|
||||
|
||||
class Bar<T extends Function> {
|
||||
n: T;
|
||||
}
|
||||
interface Bar<T extends Function> {
|
||||
y: T;
|
||||
}
|
||||
interface Baz<T extends Function> {
|
||||
y: T;
|
||||
}
|
||||
class Baz<T extends Function> {
|
||||
n: T;
|
||||
}
|
||||
|
||||
class Quux<T> {
|
||||
n: T;
|
||||
}
|
||||
interface Quux<U> {
|
||||
m: U;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user