File: restParametersOfNonArrayTypes.types

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 (68 lines) | stat: -rw-r--r-- 1,829 bytes parent folder | download | duplicates (5)
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
57
58
59
60
61
62
63
64
65
66
67
68
=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/restParametersOfNonArrayTypes.ts ===
// Rest parameters must be an array type if they have a type annotation, so all these are errors

function foo(...x: string) { }
>foo : (...x: string) => void
>x : string

var f = function foo(...x: number) { }
>f : (...x: number) => void
>function foo(...x: number) { } : (...x: number) => void
>foo : (...x: number) => void
>x : number

var f2 = (...x: Date, ...y: boolean) => { }
>f2 : (...x: Date, ...y: boolean) => void
>(...x: Date, ...y: boolean) => { } : (...x: Date, ...y: boolean) => void
>x : Date
>y : boolean

class C {
>C : C

    foo(...x: C) { }
>foo : (...x: C) => void
>x : C
}

interface I {
    (...x: string);
>x : string

    foo(...x: number, ...y: number);
>foo : (...x: number, ...y: number) => any
>x : number
>y : number
}

var a: {
>a : { (...x: string): any; foo(...x: string): any; }

    (...x: string);
>x : string

    foo(...x: string);
>foo : (...x: string) => any
>x : string
}

var b = {
>b : { foo(...x: string): void; a: (...x: number, ...y: Date) => void; b: (...x: string) => void; }
>{    foo(...x: string) { },    a: function foo(...x: number, ...y: Date) { },    b: (...x: string) => { }} : { foo(...x: string): void; a: (...x: number, ...y: Date) => void; b: (...x: string) => void; }

    foo(...x: string) { },
>foo : (...x: string) => void
>x : string

    a: function foo(...x: number, ...y: Date) { },
>a : (...x: number, ...y: Date) => void
>function foo(...x: number, ...y: Date) { } : (...x: number, ...y: Date) => void
>foo : (...x: number, ...y: Date) => void
>x : number
>y : Date

    b: (...x: string) => { }
>b : (...x: string) => void
>(...x: string) => { } : (...x: string) => void
>x : string
}