2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/compiler/assignmentCompatBug5.ts (4 errors) ====
|
|
|
|
function foo1(x: { a: number; }) { }
|
|
|
|
foo1({ b: 5 });
|
2014-07-25 02:00:03 +02:00
|
|
|
~~~~~~~~
|
2014-07-25 04:39:50 +02:00
|
|
|
!!! Argument of type '{ b: number; }' is not assignable to parameter of type '{ a: number; }'.
|
2014-07-25 02:00:03 +02:00
|
|
|
!!! Property 'a' is missing in type '{ b: number; }'.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
function foo2(x: number[]) { }
|
|
|
|
foo2(["s", "t"]);
|
2014-07-25 02:00:03 +02:00
|
|
|
~~~~~~~~~~
|
2014-07-25 04:39:50 +02:00
|
|
|
!!! Argument of type 'string[]' is not assignable to parameter of type 'number[]'.
|
2014-07-25 02:00:03 +02:00
|
|
|
!!! Type 'string' is not assignable to type 'number'.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
function foo3(x: (n: number) =>number) { };
|
|
|
|
foo3((s:string) => { });
|
2014-07-25 02:00:03 +02:00
|
|
|
~~~~~~~~~~~~~~~~~
|
2014-07-25 04:39:50 +02:00
|
|
|
!!! Argument of type '(s: string) => void' is not assignable to parameter of type '(n: number) => number'.
|
2014-07-13 01:04:16 +02:00
|
|
|
foo3((n) => { return; });
|
2014-07-25 02:00:03 +02:00
|
|
|
~~~~~~~~~~~~~~~~~~
|
2014-07-25 04:39:50 +02:00
|
|
|
!!! Argument of type '(n: number) => void' is not assignable to parameter of type '(n: number) => number'.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
|