TypeScript/tests/baselines/reference/callWithSpread4.types
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

103 lines
2.4 KiB
Plaintext

=== tests/cases/conformance/expressions/functionCalls/callWithSpread4.ts ===
type R = { a: number }
>R : R
>a : number
type W = { b: number }
>W : W
>b : number
type RW = { a: number, b: number }
>RW : RW
>a : number
>b : number
declare const pli: {
>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>; }
(s1: R, s2: RW, s3: RW, s4: RW, s5: W): Promise<void>;
>s1 : R
>s2 : RW
>s3 : RW
>s4 : RW
>s5 : W
(streams: ReadonlyArray<R | W | RW>): Promise<void>;
>streams : readonly (R | W | RW)[]
(s1: R, s2: RW | W, ...streams: Array<RW | W>): Promise<void>;
>s1 : R
>s2 : W | RW
>streams : (W | RW)[]
}
declare var writes: W
>writes : W
declare var reads: R
>reads : R
declare var tr: W
>tr : W
declare var gun: RW[]
>gun : RW[]
declare var gz: RW[]
>gz : RW[]
declare var fun: (inp: any) => AsyncGenerator<string, void, unknown>
>fun : (inp: any) => AsyncGenerator<string, void, unknown>
>inp : any
pli(
>pli( reads, ...gun, tr, fun, ...gz, writes) : Promise<void>
>pli : { (s1: R, s2: RW, s3: RW, s4: RW, s5: W): Promise<void>; (streams: readonly (R | W | RW)[]): Promise<void>; (s1: R, s2: W | RW, ...streams: (W | RW)[]): Promise<void>; }
reads,
>reads : R
...gun,
>...gun : RW
>gun : RW[]
tr,
>tr : W
fun,
>fun : (inp: any) => AsyncGenerator<string, void, unknown>
...gz,
>...gz : RW
>gz : RW[]
writes
>writes : W
);
declare function test(x: any, y: () => string): string | undefined;
>test : (x: any, y: () => string) => string | undefined
>x : any
>y : () => string
declare var anys: any[]
>anys : any[]
test(...anys)
>test(...anys) : string | undefined
>test : (x: any, y: () => string) => string | undefined
>...anys : any
>anys : any[]
pli(...[reads, writes, writes] as const)
>pli(...[reads, writes, writes] as const) : Promise<void>
>pli : { (s1: R, s2: RW, s3: RW, s4: RW, s5: W): Promise<void>; (streams: readonly (R | W | RW)[]): Promise<void>; (s1: R, s2: W | RW, ...streams: (W | RW)[]): Promise<void>; }
>...[reads, writes, writes] as const : R | W
>[reads, writes, writes] as const : readonly [R, W, W]
>[reads, writes, writes] : readonly [R, W, W]
>reads : R
>writes : W
>writes : W