TypeScript/tests/baselines/reference/callWithSpread4.errors.txt
Nathan Shively-Sanders 004b3ae018
Simplify arity errors, rewording spread errors (#43855)
* Scribbles + tests

The second test actually requires node types

* Basically working

The two simple fixes, in arity error reporting, are in, and the
simplification of arity error reporting is half-done. I haven't started
on any improvements to call assignability.

* trim out too-real test case

* Finish cleanup

And reword error a little.

* Simplify and reword spread errors

* handle spreads first

* update baselines

* Address PR comments
2021-04-29 14:38:50 -07:00

39 lines
1.5 KiB
Plaintext

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)