a515b199b7
Fixes #93. This is an evolution of #220.
32 lines
No EOL
1.6 KiB
Text
32 lines
No EOL
1.6 KiB
Text
==== tests/cases/compiler/objectLiteralFunctionArgContextualTyping2.ts (6 errors) ====
|
|
interface I2 {
|
|
value: string;
|
|
doStuff: (t: string) => string;
|
|
}
|
|
|
|
function f2(args: I2) { }
|
|
|
|
f2({ hello: 1 })
|
|
~~~~~~~~~~~~
|
|
!!! Argument type '{ hello: number; }' is not assignable to parameter type 'I2'.
|
|
!!! Property 'value' is missing in type '{ hello: number; }'.
|
|
f2({ value: '' })
|
|
~~~~~~~~~~~~~
|
|
!!! Argument type '{ value: string; }' is not assignable to parameter type 'I2'.
|
|
!!! Property 'doStuff' is missing in type '{ value: string; }'.
|
|
f2({ value: '', what: 1 })
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! Argument type '{ value: string; what: number; }' is not assignable to parameter type 'I2'.
|
|
!!! Property 'doStuff' is missing in type '{ value: string; what: number; }'.
|
|
f2({ toString: (s) => s })
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! Argument type '{ toString: (s: any) => any; }' is not assignable to parameter type 'I2'.
|
|
!!! Property 'value' is missing in type '{ toString: (s: any) => any; }'.
|
|
f2({ toString: (s: string) => s })
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! Argument type '{ toString: (s: string) => string; }' is not assignable to parameter type 'I2'.
|
|
!!! Property 'value' is missing in type '{ toString: (s: string) => string; }'.
|
|
f2({ value: '', toString: (s) => s.uhhh })
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! Argument type '{ value: string; toString: (s: any) => any; }' is not assignable to parameter type 'I2'.
|
|
!!! Property 'doStuff' is missing in type '{ value: string; toString: (s: any) => any; }'. |