File: callWithSpread4.errors.txt

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 (39 lines) | stat: -rw-r--r-- 1,506 bytes parent folder | download | duplicates (3)
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
tests/cases/conformance/expressions/functionCalls/callWithSpread4.ts(18,5): error TS2556: A spread argument must either have a tuple type or be passed to a rest parameter.
tests/cases/conformance/expressions/functionCalls/callWithSpread4.ts(27,6): error TS2556: A spread argument must either have a tuple type or be passed to a rest parameter.


==== tests/cases/conformance/expressions/functionCalls/callWithSpread4.ts (2 errors) ====
    type R = { a: number }
    type W = { b: number }
    type RW = { a: number, b: number }
    declare const pli: {
        (s1: R, s2: RW, s3: RW, s4: RW, s5: W): Promise<void>;
        (streams: ReadonlyArray<R | W | RW>): Promise<void>;
        (s1: R, s2: RW | W, ...streams: Array<RW | W>): Promise<void>;
    }
    
    declare var writes: W
    declare var reads: R
    declare var tr: W
    declare var gun: RW[]
    declare var gz: RW[]
    declare var fun: (inp: any) => AsyncGenerator<string, void, unknown>
    pli(
        reads,
        ...gun,
        ~~~~~~
!!! error TS2556: A spread argument must either have a tuple type or be passed to a rest parameter.
        tr,
        fun,
        ...gz,
        writes
    );
    
    declare function test(x: any, y: () => string): string | undefined;
    declare var anys: any[]
    test(...anys)
         ~~~~~~~
!!! error TS2556: A spread argument must either have a tuple type or be passed to a rest parameter.
    
    pli(...[reads, writes, writes] as const)