22 lines
No EOL
928 B
Text
22 lines
No EOL
928 B
Text
==== tests/cases/compiler/assignmentCompatBug5.ts (4 errors) ====
|
|
function foo1(x: { a: number; }) { }
|
|
foo1({ b: 5 });
|
|
~~~~~~~~
|
|
!!! Argument of type '{ b: number; }' is not assignable to parameter of type '{ a: number; }'.
|
|
!!! Property 'a' is missing in type '{ b: number; }'.
|
|
|
|
function foo2(x: number[]) { }
|
|
foo2(["s", "t"]);
|
|
~~~~~~~~~~
|
|
!!! Argument of type 'string[]' is not assignable to parameter of type 'number[]'.
|
|
!!! Type 'string' is not assignable to type 'number'.
|
|
|
|
function foo3(x: (n: number) =>number) { };
|
|
foo3((s:string) => { });
|
|
~~~~~~~~~~~~~~~~~
|
|
!!! Argument of type '(s: string) => void' is not assignable to parameter of type '(n: number) => number'.
|
|
foo3((n) => { return; });
|
|
~~~~~~~~~~~~~~~~~~
|
|
!!! Argument of type '(n: number) => void' is not assignable to parameter of type '(n: number) => number'.
|
|
|
|
|