File: overloadsWithProvisionalErrors.js

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (15 lines) | stat: -rw-r--r-- 1,017 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//// [overloadsWithProvisionalErrors.ts]
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)
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)
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

//// [overloadsWithProvisionalErrors.js]
var func;
func(function (s) { return ({}); }); // Error for no applicable overload (object type is missing a and b)
func(function (s) { return ({ a: blah, b: 3 }); }); // Only error inside the function, but not outside (since it would be applicable if not for the provisional error)
func(function (s) { return ({ a: blah }); }); // Two errors here, one for blah not being defined, and one for the overload since it would not be applicable anyway