Files
tsgo/testdata/baselines/reference/submodule/compiler/baseClassImprovedMismatchErrors.errors.txt

78 lines
5.0 KiB
Plaintext

baseClassImprovedMismatchErrors.ts(2,5): error TS2564: Property 'n' has no initializer and is not definitely assigned in the constructor.
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'.
baseClassImprovedMismatchErrors.ts(8,5): error TS2564: Property 'n' has no initializer and is not definitely assigned in the constructor.
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'.
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'.
baseClassImprovedMismatchErrors.ts(14,5): error TS2564: Property 'n' has no initializer and is not definitely assigned in the constructor.
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'.
==== baseClassImprovedMismatchErrors.ts (7 errors) ====
class Base {
n: Base | string;
~
!!! error TS2564: Property 'n' has no initializer and is not definitely assigned in the constructor.
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'.
~
!!! error TS2564: Property 'n' has no initializer and is not definitely assigned in the constructor.
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'.
~
!!! error TS2564: Property 'n' has no initializer and is not definitely assigned in the constructor.
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;
}
}