TypeScript/tests/baselines/reference/fuzzy.errors.txt
Matt McCutchen da64479a64 Improve the error message when asserting to a type that is not
comparable to the original.

Also improve the error message for implicit conversion of a symbol to a
string in a template literal, which previously shared the error message
with type assertions.

Fixes #25539.  Addresses #25870.
2018-07-25 19:13:10 -04:00

49 lines
No EOL
2.1 KiB
Text

tests/cases/compiler/fuzzy.ts(13,18): error TS2420: Class 'C' incorrectly implements interface 'I'.
Property 'alsoWorks' is missing in type 'C'.
tests/cases/compiler/fuzzy.ts(21,34): error TS2322: Type 'this' is not assignable to type 'I'.
Type 'C' is not assignable to type 'I'.
tests/cases/compiler/fuzzy.ts(25,20): error TS2352: Conversion of type '{ oneI: this; }' to type 'R' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Property 'anything' is missing in type '{ oneI: this; }'.
==== tests/cases/compiler/fuzzy.ts (3 errors) ====
module M {
export interface I {
works:()=>R;
alsoWorks:()=>R;
doesntWork:()=>R;
}
export interface R {
anything:number;
oneI:I;
}
export class C implements I {
~
!!! error TS2420: Class 'C' incorrectly implements interface 'I'.
!!! error TS2420: Property 'alsoWorks' is missing in type 'C'.
constructor(public x:number) {
}
works():R {
return <R>({ anything: 1 });
}
doesntWork():R {
return { anything:1, oneI:this };
~~~~
!!! error TS2322: Type 'this' is not assignable to type 'I'.
!!! error TS2322: Type 'C' is not assignable to type 'I'.
!!! related TS6500 tests/cases/compiler/fuzzy.ts:10:9: The expected type comes from property 'oneI' which is declared here on type 'R'
}
worksToo():R {
return <R>({ oneI: this });
~~~~~~~~~~~~~~~~~~~
!!! error TS2352: Conversion of type '{ oneI: this; }' to type 'R' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
!!! error TS2352: Property 'anything' is missing in type '{ oneI: this; }'.
}
}
}