12 lines
680 B
Text
12 lines
680 B
Text
|
==== tests/cases/compiler/assignmentCompatFunctionsWithOptionalArgs.ts (3 errors) ====
|
||
|
function foo(x: { id: number; name?: string; }): void;
|
||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
!!! Function implementation expected.
|
||
|
foo({ id: 1234 }); // Ok
|
||
|
foo({ id: 1234, name: "hello" }); // Ok
|
||
|
foo({ id: 1234, name: false }); // Error, name of wrong type
|
||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
!!! Supplied parameters do not match any signature of call target.
|
||
|
foo({ name: "hello" }); // Error, id required but missing
|
||
|
~~~~~~~~~~~~~~~~~~~~~~
|
||
|
!!! Supplied parameters do not match any signature of call target.
|