Skip to content

fix(lint): keep the message chains of type errors and tsconfig errors - #1006

Merged
camc314 merged 2 commits into
oxc-project:mainfrom
magurotuna:fix/lint-message-chains-main
Nov 17, 2026
Merged

camc314 merged 2 commits into
oxc-project:mainfrom
magurotuna:fix/lint-message-chains-main

Conversation

@magurotuna

Copy link
Copy Markdown
Member

tsrs-lint sent only the first line of a TypeScript diagnostic to Oxlint, the same as tsgolint. The message chain, the lines that tell the reason, was lost. Now a type error has the message chain in its description, and a tsconfig-error report has the message chain in its help, after the TypeScript message. Both match what tsc prints. A diagnostic without a chain does not change, except for a type error in code that a content mapper generated: that type error now gets the note that tsc prints for such code (This location is in virtual code produced by the content mapper ...).

oxlint -A all --type-aware --type-check on export const f: (a: number) => void = (a: string) => {};:

   x typescript(TS2322): Type '(a: string) => void' is not assignable to type '(a: number) => void'.
+  |   Types of parameters 'a' and 'a' are incompatible.
+  |     Type 'number' is not assignable to type 'string'.
    ,-[a.ts:1:14]
  1 | export const f: (a: number) => void = (a: string) => {};
    :              ^
    `----

The same command with "types": ["missing-types-pkg"] in the tsconfig, where the package does not exist:

   x typescript(tsconfig-error): Invalid tsconfig
   help: Cannot find type definition file for 'missing-types-pkg'.
+          The file is in the program because:
+            Entry point of type library 'missing-types-pkg' specified in compilerOptions

AI assistance: written with Claude Code.

The help of a `tsconfig-error` report had only the first line of the
diagnostic. For TS18099, that line is "The content mapper '{0}' could
not be initialized." The reason is in the message chain: for example,
the process exited before it responded to `initialize`, or it did not
respond within 5 seconds. tsc prints the chain, but tsrs-lint dropped
it. So a mapper process that exited looked like a mapper that timed
out.

Now the help has the message chain, flattened as tsc prints it and as
the language server converts it. A diagnostic without a chain has the
same help as before.

AI assistance: written with Claude Code.
A type error such as TS2322 has a message chain: the lines that tell
why the types are not assignable. `tsc` and the language server show
each message of the chain on its own line, but tsrs-lint reported only
the first line, the same as tsgolint. For example, the description
`No overload matches this call.` lost all of its reasons.

Now the description of a type error has the message chain, as `tsc`
prints it. A message without a chain does not change, except for a
type error in code that a content mapper generated: that type error
now gets the note that `tsc` prints for such code. The help of a
`tsconfig-error` report uses the same function, so its text does not
change.

AI assistance: written with Claude Code.
@codspeed

codspeed Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

⚠️ 4 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

βœ… 8 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing magurotuna:fix/lint-message-chains-main (48058bf) with main (b12862d)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@magurotuna
magurotuna marked this pull request as ready for review November 17, 2026 05:37
@camc314
camc314 added this pull request to the merge queue Nov 17, 2026
Merged via the queue into oxc-project:main with commit b26fe50 Nov 17, 2026
123 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants