1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-07 14:48:14 -05:00

fix(check): line-break between diagnostic message chain entries (#27543)

This commit is contained in:
Nayeem Rahman 2025-01-03 18:30:41 +00:00 committed by GitHub
parent e9af7f8ebd
commit 18b813b93f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 25 additions and 1 deletions

View file

@ -90,9 +90,9 @@ impl DiagnosticMessageChain {
s.push_str(&" ".repeat(level * 2));
s.push_str(&self.message_text);
if let Some(next) = &self.next {
s.push('\n');
let arr = next.clone();
for dm in arr {
s.push('\n');
s.push_str(&dm.format_message(level + 1));
}
}

View file

@ -0,0 +1,6 @@
// Regression test for https://github.com/denoland/deno/issues/27411.
{
"args": "check --quiet message_chain_formatting.ts",
"output": "message_chain_formatting.out",
"exitCode": 1
}

View file

@ -0,0 +1,10 @@
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 [WILDLINE]/message_chain_formatting.ts:8:1

View file

@ -0,0 +1,8 @@
function foo(s: string, b: boolean): void;
function foo(ss: string[], b: boolean): void;
function foo(ss: string[], b: Date): void;
function foo(sOrSs: string | string[], b: boolean | Date): void {
console.log(sOrSs, b);
}
foo("hello", 42);