File: callOverload.types

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (56 lines) | stat: -rw-r--r-- 1,074 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
=== tests/cases/conformance/expressions/functionCalls/callOverload.ts ===
declare function fn(x: any): void;
>fn : (x: any) => void
>x : any

declare function takeTwo(x: any, y: any): void;
>takeTwo : (x: any, y: any) => void
>x : any
>y : any

declare function withRest(a: any, ...args: Array<any>): void;
>withRest : (a: any, ...args: Array<any>) => void
>a : any
>args : any[]

var n: number[];
>n : number[]

fn(1) // no error
>fn(1) : void
>fn : (x: any) => void
>1 : 1

fn(1, 2, 3, 4)
>fn(1, 2, 3, 4) : void
>fn : (x: any) => void
>1 : 1
>2 : 2
>3 : 3
>4 : 4

takeTwo(1, 2, 3, 4)
>takeTwo(1, 2, 3, 4) : void
>takeTwo : (x: any, y: any) => void
>1 : 1
>2 : 2
>3 : 3
>4 : 4

withRest('a', ...n); // no error
>withRest('a', ...n) : void
>withRest : (a: any, ...args: any[]) => void
>'a' : "a"
>...n : number
>n : number[]

withRest();
>withRest() : void
>withRest : (a: any, ...args: any[]) => void

withRest(...n); 
>withRest(...n) : void
>withRest : (a: any, ...args: any[]) => void
>...n : number
>n : number[]