2014-07-13 01:04:16 +02:00
|
|
|
==== 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 {
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2421: Class 'C' incorrectly implements interface 'I':
|
|
|
|
!!! error TS2421: Property 'alsoWorks' is missing in type 'C'.
|
2014-07-13 01:04:16 +02:00
|
|
|
constructor(public x:number) {
|
|
|
|
}
|
|
|
|
works():R {
|
|
|
|
return <R>({ anything: 1 });
|
|
|
|
}
|
|
|
|
|
|
|
|
doesntWork():R {
|
|
|
|
return { anything:1, oneI:this };
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2322: Type '{ anything: number; oneI: C; }' is not assignable to type 'R':
|
|
|
|
!!! error TS2322: Types of property 'oneI' are incompatible:
|
|
|
|
!!! error TS2322: Type 'C' is not assignable to type 'I'.
|
2014-07-13 01:04:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
worksToo():R {
|
|
|
|
return <R>({ oneI: this });
|
|
|
|
~~~~~~~~~~~~~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2353: Neither type '{ oneI: C; }' nor type 'R' is assignable to the other:
|
|
|
|
!!! error TS2353: Property 'anything' is missing in type '{ oneI: C; }'.
|
2014-07-13 01:04:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|