e1fda834f3
* Cache complex union/intersection relations * Accept new baselines * Accept new baselines
69 lines
4.3 KiB
Plaintext
69 lines
4.3 KiB
Plaintext
tests/cases/compiler/baseClassImprovedMismatchErrors.ts(8,5): error TS2416: Property 'n' in type 'Derived' is not assignable to the same property in base type 'Base'.
|
|
Type 'string | Derived' is not assignable to type 'string | Base'.
|
|
Type 'Derived' is not assignable to type 'string | Base'.
|
|
Type 'Derived' is not assignable to type 'Base'.
|
|
The types returned by 'fn()' are incompatible between these types.
|
|
Type 'string | number' is not assignable to type 'number'.
|
|
Type 'string' is not assignable to type 'number'.
|
|
tests/cases/compiler/baseClassImprovedMismatchErrors.ts(9,5): error TS2416: Property 'fn' in type 'Derived' is not assignable to the same property in base type 'Base'.
|
|
Type '() => string | number' is not assignable to type '() => number'.
|
|
Type 'string | number' is not assignable to type 'number'.
|
|
Type 'string' is not assignable to type 'number'.
|
|
tests/cases/compiler/baseClassImprovedMismatchErrors.ts(14,5): error TS2416: Property 'n' in type 'DerivedInterface' is not assignable to the same property in base type 'Base'.
|
|
Type 'string | DerivedInterface' is not assignable to type 'string | Base'.
|
|
Type 'DerivedInterface' is not assignable to type 'string | Base'.
|
|
Type 'DerivedInterface' is not assignable to type 'Base'.
|
|
The types returned by 'fn()' are incompatible between these types.
|
|
Type 'string | number' is not assignable to type 'number'.
|
|
Type 'string' is not assignable to type 'number'.
|
|
tests/cases/compiler/baseClassImprovedMismatchErrors.ts(15,5): error TS2416: Property 'fn' in type 'DerivedInterface' is not assignable to the same property in base type 'Base'.
|
|
Type '() => string | number' is not assignable to type '() => number'.
|
|
Type 'string | number' is not assignable to type 'number'.
|
|
Type 'string' is not assignable to type 'number'.
|
|
|
|
|
|
==== tests/cases/compiler/baseClassImprovedMismatchErrors.ts (4 errors) ====
|
|
class Base {
|
|
n: Base | string;
|
|
fn() {
|
|
return 10;
|
|
}
|
|
}
|
|
class Derived extends Base {
|
|
n: Derived | string;
|
|
~
|
|
!!! error TS2416: Property 'n' in type 'Derived' is not assignable to the same property in base type 'Base'.
|
|
!!! error TS2416: Type 'string | Derived' is not assignable to type 'string | Base'.
|
|
!!! error TS2416: Type 'Derived' is not assignable to type 'string | Base'.
|
|
!!! error TS2416: Type 'Derived' is not assignable to type 'Base'.
|
|
!!! error TS2416: The types returned by 'fn()' are incompatible between these types.
|
|
!!! error TS2416: Type 'string | number' is not assignable to type 'number'.
|
|
!!! error TS2416: Type 'string' is not assignable to type 'number'.
|
|
fn() {
|
|
~~
|
|
!!! error TS2416: Property 'fn' in type 'Derived' is not assignable to the same property in base type 'Base'.
|
|
!!! error TS2416: Type '() => string | number' is not assignable to type '() => number'.
|
|
!!! error TS2416: Type 'string | number' is not assignable to type 'number'.
|
|
!!! error TS2416: Type 'string' is not assignable to type 'number'.
|
|
return 10 as number | string;
|
|
}
|
|
}
|
|
class DerivedInterface implements Base {
|
|
n: DerivedInterface | string;
|
|
~
|
|
!!! error TS2416: Property 'n' in type 'DerivedInterface' is not assignable to the same property in base type 'Base'.
|
|
!!! error TS2416: Type 'string | DerivedInterface' is not assignable to type 'string | Base'.
|
|
!!! error TS2416: Type 'DerivedInterface' is not assignable to type 'string | Base'.
|
|
!!! error TS2416: Type 'DerivedInterface' is not assignable to type 'Base'.
|
|
!!! error TS2416: The types returned by 'fn()' are incompatible between these types.
|
|
!!! error TS2416: Type 'string | number' is not assignable to type 'number'.
|
|
!!! error TS2416: Type 'string' is not assignable to type 'number'.
|
|
fn() {
|
|
~~
|
|
!!! error TS2416: Property 'fn' in type 'DerivedInterface' is not assignable to the same property in base type 'Base'.
|
|
!!! error TS2416: Type '() => string | number' is not assignable to type '() => number'.
|
|
!!! error TS2416: Type 'string | number' is not assignable to type 'number'.
|
|
!!! error TS2416: Type 'string' is not assignable to type 'number'.
|
|
return 10 as number | string;
|
|
}
|
|
} |