52 lines
2 KiB
Plaintext
52 lines
2 KiB
Plaintext
tests/cases/compiler/elaboratedErrors.ts(10,7): error TS2420: Class 'WorkerFS' incorrectly implements interface 'FileSystem'.
|
|
Types of property 'read' are incompatible.
|
|
Type 'string' is not assignable to type 'number'.
|
|
tests/cases/compiler/elaboratedErrors.ts(20,1): error TS2322: Type 'Beta' is not assignable to type 'Alpha'.
|
|
Property 'x' is missing in type 'Beta'.
|
|
tests/cases/compiler/elaboratedErrors.ts(21,1): error TS2322: Type 'Beta' is not assignable to type 'Alpha'.
|
|
tests/cases/compiler/elaboratedErrors.ts(24,1): error TS2322: Type 'Alpha' is not assignable to type 'Beta'.
|
|
Property 'y' is missing in type 'Alpha'.
|
|
tests/cases/compiler/elaboratedErrors.ts(25,1): error TS2322: Type 'Alpha' is not assignable to type 'Beta'.
|
|
|
|
|
|
==== tests/cases/compiler/elaboratedErrors.ts (5 errors) ====
|
|
interface FileSystem {
|
|
read: number;
|
|
}
|
|
|
|
function fn(s: WorkerFS): void;
|
|
function fn(s: FileSystem): void;
|
|
function fn(s: FileSystem|WorkerFS) { }
|
|
|
|
// This should issue a large error, not a small one
|
|
class WorkerFS implements FileSystem {
|
|
~~~~~~~~
|
|
!!! error TS2420: Class 'WorkerFS' incorrectly implements interface 'FileSystem'.
|
|
!!! error TS2420: Types of property 'read' are incompatible.
|
|
!!! error TS2420: Type 'string' is not assignable to type 'number'.
|
|
read: string;
|
|
}
|
|
|
|
interface Alpha { x: string; }
|
|
interface Beta { y: number; }
|
|
var x: Alpha;
|
|
var y: Beta;
|
|
|
|
// Only one of these errors should be large
|
|
x = y;
|
|
~
|
|
!!! error TS2322: Type 'Beta' is not assignable to type 'Alpha'.
|
|
!!! error TS2322: Property 'x' is missing in type 'Beta'.
|
|
x = y;
|
|
~
|
|
!!! error TS2322: Type 'Beta' is not assignable to type 'Alpha'.
|
|
|
|
// Only one of these errors should be large
|
|
y = x;
|
|
~
|
|
!!! error TS2322: Type 'Alpha' is not assignable to type 'Beta'.
|
|
!!! error TS2322: Property 'y' is missing in type 'Alpha'.
|
|
y = x;
|
|
~
|
|
!!! error TS2322: Type 'Alpha' is not assignable to type 'Beta'.
|
|
|