File: callWithSpread2.errors.txt

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 (79 lines) | stat: -rw-r--r-- 4,614 bytes parent folder | download
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
69
70
71
72
73
74
75
76
77
78
79
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(22,1): error TS2556: Expected 1 arguments, but got 2 or more.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(23,1): error TS2556: Expected 0 arguments, but got 1 or more.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(26,5): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'.
  Type 'string' is not assignable to type 'number'.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(27,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(28,13): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'.
  Type 'string' is not assignable to type 'number'.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(29,13): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(30,11): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'.
  Type 'string' is not assignable to type 'number'.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(31,11): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(32,1): error TS2556: Expected 1-3 arguments, but got 0 or more.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(33,1): error TS2556: Expected 1-3 arguments, but got 0 or more.
tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(34,8): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.


==== tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts (11 errors) ====
    declare function all(a?: number, b?: number): void;
    declare function weird(a?: number | string, b?: number | string): void;
    declare function prefix(s: string, a?: number, b?: number): void;
    declare function rest(s: string, a?: number, b?: number,  ...rest: number[]): void;
    declare function normal(s: string): void;
    declare function thunk(): string;
    
    declare var ns: number[];
    declare var mixed: (number | string)[];
    declare var tuple: [number, string];
    
    // good
    all(...ns)
    weird(...ns)
    weird(...mixed)
    weird(...tuple)
    prefix("a", ...ns)
    rest("d", ...ns)
    
    
    // extra arguments
    normal("g", ...ns)
    ~~~~~~~~~~~~~~~~~~
!!! error TS2556: Expected 1 arguments, but got 2 or more.
    thunk(...ns)
    ~~~~~~~~~~~~
!!! error TS2556: Expected 0 arguments, but got 1 or more.
    
    // bad
    all(...mixed)
        ~~~~~~~~
!!! error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'.
!!! error TS2345:   Type 'string' is not assignable to type 'number'.
    all(...tuple)
        ~~~~~~~~
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
    prefix("b", ...mixed)
                ~~~~~~~~
!!! error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'.
!!! error TS2345:   Type 'string' is not assignable to type 'number'.
    prefix("c", ...tuple)
                ~~~~~~~~
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
    rest("e", ...mixed)
              ~~~~~~~~
!!! error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'.
!!! error TS2345:   Type 'string' is not assignable to type 'number'.
    rest("f", ...tuple)
              ~~~~~~~~
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
    prefix(...ns) // required parameters are required
    ~~~~~~~~~~~~~
!!! error TS2556: Expected 1-3 arguments, but got 0 or more.
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts:3:25: An argument for 's' was not provided.
    prefix(...mixed)
    ~~~~~~~~~~~~~~~~
!!! error TS2556: Expected 1-3 arguments, but got 0 or more.
!!! related TS6210 tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts:3:25: An argument for 's' was not provided.
    prefix(...tuple)
           ~~~~~~~~
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.