TypeScript/tests/cases/conformance/interfaces/declarationMerging/twoGenericInterfacesWithDifferentConstraints.ts
Wesley Wigham 5e06bea481
getConstraintDeclaration gets the first declaration with a constraint… (#33426)
* getConstraintDeclaration gets the first declaration with a constraint, rather than just the first declaration

* Add type annotation

* Update comment
2019-09-18 13:56:24 -07:00

62 lines
897 B
TypeScript

interface A<T extends Date> {
x: T;
}
interface A<T extends Number> { // error
y: T;
}
module M {
interface B<T extends A<Date>> {
x: T;
}
interface B<T extends A<any>> { // error
y: T;
}
}
module M2 {
interface A<T extends Date> {
x: T;
}
}
module M2 {
interface A<T extends Number> { // ok, different declaration space from other M2.A
y: T;
}
}
module M3 {
export interface A<T extends Date> {
x: T;
}
}
module M3 {
export interface A<T extends Number> { // error
y: T;
}
}
interface B<T extends number> {
u: T;
v: Constraint<T>; // ok
}
interface B<T> { // ok
x: T;
y: Constraint<T>; // ok
}
interface C<T> {
x: T;
}
interface C<T extends number> { // ok
y: T;
}
interface Constraint<T extends number> {}