16 lines
No EOL
711 B
Text
16 lines
No EOL
711 B
Text
==== tests/cases/compiler/assignLambdaToNominalSubtypeOfFunction.ts (2 errors) ====
|
|
interface IResultCallback extends Function {
|
|
x: number;
|
|
}
|
|
|
|
function fn(cb: IResultCallback) { }
|
|
|
|
fn((a, b) => true);
|
|
~~~~~~~~~~~~~~
|
|
!!! Argument of type '(a: any, b: any) => boolean' is not assignable to parameter of type 'IResultCallback'.
|
|
!!! Property 'x' is missing in type '(a: any, b: any) => boolean'.
|
|
fn(function (a, b) { return true; })
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! Argument of type '(a: any, b: any) => boolean' is not assignable to parameter of type 'IResultCallback'.
|
|
!!! Property 'x' is missing in type '(a: any, b: any) => boolean'.
|
|
|