Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error messages on subsequent overloads should start on new lines #27411

Open
dandv opened this issue Dec 18, 2024 · 0 comments
Open

Error messages on subsequent overloads should start on new lines #27411

dandv opened this issue Dec 18, 2024 · 0 comments

Comments

@dandv
Copy link

dandv commented Dec 18, 2024

Version: Deno 2.1.4

Running deno check on the script below produces an error that could be made a bit more readable:

function foo(s: string, b: boolean): void;
function foo(ss: string[], b: boolean): void;
function foo(sOrSs: string | string[], b: boolean): void {
  console.log(sOrSs, b);
}

foo('hello', 42);
$ deno check denobug-overloads.ts 
Check file:///home/dandv/deno/denobug-overloads.ts
error: TS2769 [ERROR]: No overload matches this call.
Overload 1 of 3, '(s: string, b: boolean): void', gave the following error.
    Argument of type 'number' is not assignable to parameter of type 'boolean'.  Overload 2 of 3, '(ss: string[], b: boolean): void', gave the following error.
    Argument of type 'string' is not assignable to parameter of type 'string[]'.  Overload 3 of 3, '(ss: string[], b: Date): void', gave the following error.
    Argument of type 'string' is not assignable to parameter of type 'string[]'.
foo('hello', 42);
~~~
    at file:///home/dandv/deno/denobug-overloads.ts:7:1

The sentences "Overload [23] of 3..." would be more readable if they started on their own lines, indented with 2 spaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant