|
| 1 | +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(30,5): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. |
| 2 | + Type 'string' is not assignable to type 'number'. |
| 3 | +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(31,5): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. |
| 4 | + Type 'string' is not assignable to type 'number'. |
| 5 | +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(32,13): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. |
| 6 | + Type 'string' is not assignable to type 'number'. |
| 7 | +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(33,13): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. |
| 8 | + Type 'string' is not assignable to type 'number'. |
| 9 | +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(34,11): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. |
| 10 | + Type 'string' is not assignable to type 'number'. |
| 11 | +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(35,11): error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. |
| 12 | + Type 'string' is not assignable to type 'number'. |
| 13 | +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(36,1): error TS2346: Supplied parameters do not match any signature of call target. |
| 14 | +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(37,1): error TS2346: Supplied parameters do not match any signature of call target. |
| 15 | +tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts(38,1): error TS2346: Supplied parameters do not match any signature of call target. |
| 16 | + |
| 17 | + |
| 18 | +==== tests/cases/conformance/expressions/functionCalls/callWithSpread2.ts (9 errors) ==== |
| 19 | + declare function all(a?: number, b?: number): void; |
| 20 | + declare function weird(a?: number | string, b?: number | string): void; |
| 21 | + declare function prefix(s: string, a?: number, b?: number): void; |
| 22 | + declare function rest(s: string, a?: number, b?: number, ...rest: number[]): void; |
| 23 | + declare function normal(s: string): void; |
| 24 | + declare function thunk(): string; |
| 25 | + |
| 26 | + declare var ns: number[]; |
| 27 | + declare var mixed: (number | string)[]; |
| 28 | + declare var tuple: [number, string]; |
| 29 | + |
| 30 | + // good |
| 31 | + all(...ns) |
| 32 | + weird(...ns) |
| 33 | + weird(...mixed) |
| 34 | + weird(...tuple) |
| 35 | + prefix("a", ...ns) |
| 36 | + rest("d", ...ns) |
| 37 | + |
| 38 | + |
| 39 | + // this covers the arguments case |
| 40 | + normal("g", ...ns) |
| 41 | + normal("h", ...mixed) |
| 42 | + normal("i", ...tuple) |
| 43 | + thunk(...ns) |
| 44 | + thunk(...mixed) |
| 45 | + thunk(...tuple) |
| 46 | + |
| 47 | + // bad |
| 48 | + all(...mixed) |
| 49 | + ~~~~~~~~ |
| 50 | +!!! error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. |
| 51 | +!!! error TS2345: Type 'string' is not assignable to type 'number'. |
| 52 | + all(...tuple) |
| 53 | + ~~~~~~~~ |
| 54 | +!!! error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. |
| 55 | +!!! error TS2345: Type 'string' is not assignable to type 'number'. |
| 56 | + prefix("b", ...mixed) |
| 57 | + ~~~~~~~~ |
| 58 | +!!! error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. |
| 59 | +!!! error TS2345: Type 'string' is not assignable to type 'number'. |
| 60 | + prefix("c", ...tuple) |
| 61 | + ~~~~~~~~ |
| 62 | +!!! error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. |
| 63 | +!!! error TS2345: Type 'string' is not assignable to type 'number'. |
| 64 | + rest("e", ...mixed) |
| 65 | + ~~~~~~~~ |
| 66 | +!!! error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. |
| 67 | +!!! error TS2345: Type 'string' is not assignable to type 'number'. |
| 68 | + rest("f", ...tuple) |
| 69 | + ~~~~~~~~ |
| 70 | +!!! error TS2345: Argument of type 'string | number' is not assignable to parameter of type 'number'. |
| 71 | +!!! error TS2345: Type 'string' is not assignable to type 'number'. |
| 72 | + prefix(...ns) // required parameters are required |
| 73 | + ~~~~~~~~~~~~~ |
| 74 | +!!! error TS2346: Supplied parameters do not match any signature of call target. |
| 75 | + prefix(...mixed) |
| 76 | + ~~~~~~~~~~~~~~~~ |
| 77 | +!!! error TS2346: Supplied parameters do not match any signature of call target. |
| 78 | + prefix(...tuple) |
| 79 | + ~~~~~~~~~~~~~~~~ |
| 80 | +!!! error TS2346: Supplied parameters do not match any signature of call target. |
| 81 | + |
0 commit comments