mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-30 07:14:39 +08:00
35 lines
2.1 KiB
Plaintext
35 lines
2.1 KiB
Plaintext
overloaded-function-values.ts:16:7 - error SC2007: values of type '{ (event: "exit", code: number): void; (event: "error", err: string): void; }' cannot be compiled: the type declares multiple call signatures (overloads), and a compiled function value is always one concrete signature
|
|
|
|
15 | // compile to Node's ReferenceError at the root instead).
|
|
16 | const on = ((() => {}) as unknown) as { (event: "exit", code: number): void; (event: "error", err: string): void };
|
|
| ^~
|
|
17 | const listener = on;
|
|
|
|
hint: annotate the slot with the ONE signature the program actually calls (e.g. '(x: number) => string'), or wrap the overloaded function in a single-signature arrow
|
|
|
|
overloaded-function-values.ts:17:7 - error SC2007: values of type '{ (event: "exit", code: number): void; (event: "error", err: string): void; }' cannot be compiled: the type declares multiple call signatures (overloads), and a compiled function value is always one concrete signature
|
|
|
|
16 | const on = ((() => {}) as unknown) as { (event: "exit", code: number): void; (event: "error", err: string): void };
|
|
17 | const listener = on;
|
|
| ^~~~~~~~
|
|
18 | console.log(listener("exit", 0));
|
|
|
|
hint: annotate the slot with the ONE signature the program actually calls (e.g. '(x: number) => string'), or wrap the overloaded function in a single-signature arrow
|
|
|
|
overloaded-function-values.ts:17:18 - error SC2004: uses of 'on' inherit the blocker on its declaration
|
|
|
|
16 | const on = ((() => {}) as unknown) as { (event: "exit", code: number): void; (event: "error", err: string): void };
|
|
17 | const listener = on;
|
|
| ^~
|
|
18 | console.log(listener("exit", 0));
|
|
|
|
hint: the declaration of 'on' did not compile — fix the diagnostic reported there and these sites clear with it
|
|
|
|
overloaded-function-values.ts:18:13 - error SC2004: uses of 'listener' inherit the blocker on its declaration
|
|
|
|
17 | const listener = on;
|
|
18 | console.log(listener("exit", 0));
|
|
| ^~~~~~~~
|
|
19 |
|
|
|
|
hint: the declaration of 'listener' did not compile — fix the diagnostic reported there and these sites clear with it |