6e77e2e810
Also got rid of the 'terminalMessages' concept.
42 lines
No EOL
2.5 KiB
Text
42 lines
No EOL
2.5 KiB
Text
tests/cases/compiler/genericTypeWithNonGenericBaseMisMatch.ts(4,7): error TS2420: Class 'X<T>' incorrectly implements interface 'I'.
|
|
Types of property 'f' are incompatible.
|
|
Type '(a: T) => void' is not assignable to type '(a: { a: number; }) => void'.
|
|
Types of parameters 'a' and 'a' are incompatible.
|
|
Type 'T' is not assignable to type '{ a: number; }'.
|
|
Types of property 'a' are incompatible.
|
|
Type 'string' is not assignable to type 'number'.
|
|
tests/cases/compiler/genericTypeWithNonGenericBaseMisMatch.ts(8,5): error TS2323: Type 'X<{ a: string; }>' is not assignable to type 'I'.
|
|
Types of property 'f' are incompatible.
|
|
Type '(a: { a: string; }) => void' is not assignable to type '(a: { a: number; }) => void'.
|
|
Types of parameters 'a' and 'a' are incompatible.
|
|
Type '{ a: string; }' is not assignable to type '{ a: number; }'.
|
|
Types of property 'a' are incompatible.
|
|
Type 'string' is not assignable to type 'number'.
|
|
|
|
|
|
==== tests/cases/compiler/genericTypeWithNonGenericBaseMisMatch.ts (2 errors) ====
|
|
interface I {
|
|
f: (a: { a: number }) => void
|
|
}
|
|
class X<T extends { a: string }> implements I {
|
|
~
|
|
!!! error TS2420: Class 'X<T>' incorrectly implements interface 'I'.
|
|
!!! error TS2420: Types of property 'f' are incompatible.
|
|
!!! error TS2420: Type '(a: T) => void' is not assignable to type '(a: { a: number; }) => void'.
|
|
!!! error TS2420: Types of parameters 'a' and 'a' are incompatible.
|
|
!!! error TS2420: Type 'T' is not assignable to type '{ a: number; }'.
|
|
!!! error TS2420: Types of property 'a' are incompatible.
|
|
!!! error TS2420: Type 'string' is not assignable to type 'number'.
|
|
f(a: T): void { }
|
|
}
|
|
var x = new X<{ a: string }>();
|
|
var i: I = x; // Should not be allowed -- type of 'f' is incompatible with 'I'
|
|
~
|
|
!!! error TS2323: Type 'X<{ a: string; }>' is not assignable to type 'I'.
|
|
!!! error TS2323: Types of property 'f' are incompatible.
|
|
!!! error TS2323: Type '(a: { a: string; }) => void' is not assignable to type '(a: { a: number; }) => void'.
|
|
!!! error TS2323: Types of parameters 'a' and 'a' are incompatible.
|
|
!!! error TS2323: Type '{ a: string; }' is not assignable to type '{ a: number; }'.
|
|
!!! error TS2323: Types of property 'a' are incompatible.
|
|
!!! error TS2323: Type 'string' is not assignable to type 'number'.
|
|
|