2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/compiler/overloadsWithProvisionalErrors.ts (4 errors) ====
|
|
|
|
var func: {
|
|
|
|
(s: string): number;
|
|
|
|
(lambda: (s: string) => { a: number; b: number }): string;
|
|
|
|
};
|
|
|
|
|
|
|
|
func(s => ({})); // Error for no applicable overload (object type is missing a and b)
|
2014-07-25 02:00:03 +02:00
|
|
|
~~~~~~~~~
|
2014-07-25 04:39:50 +02:00
|
|
|
!!! Argument of type '(s: string) => {}' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'.
|
2014-07-13 01:04:16 +02:00
|
|
|
func(s => ({ a: blah, b: 3 })); // Only error inside the function, but not outside (since it would be applicable if not for the provisional error)
|
|
|
|
~~~~
|
|
|
|
!!! Cannot find name 'blah'.
|
|
|
|
func(s => ({ a: blah })); // Two errors here, one for blah not being defined, and one for the overload since it would not be applicable anyway
|
2014-07-25 02:00:03 +02:00
|
|
|
~~~~~~~~~~~~~~~~~~
|
2014-07-25 04:39:50 +02:00
|
|
|
!!! Argument of type '(s: string) => { a: unknown; }' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'.
|
2014-07-13 01:04:16 +02:00
|
|
|
~~~~
|
|
|
|
!!! Cannot find name 'blah'.
|