Allow content mappers emit diagnostics with different severity levels #64932
Copy link
Copy link
Open
Labels
SuggestionAn idea for TypeScriptAn idea for TypeScript
Description
🔍 Search Terms
content mappers, diagnostics, warning
✅ Viability Checklist
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
⭐ Suggestion
Currently, all diagnostics returned by a content mappers are treated as errors. It would be nice if content mappers could also produce warnings.
📃 Motivating Example
For example, a Svelte content mapper could emit warnings for the svelte's compiler warnings.
💻 Use Cases
- Compiler warnings in compiled languages
- Flagging duplicate keys in simple formats that allow them
- Flagging trailing commas in json.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
SuggestionAn idea for TypeScriptAn idea for TypeScript
Activity
RyanCavanaugh commentedon Oct 26, 2026
Notably, TS itself does not have a 'warning' concept, so this is a heavy lift on its own
blt-r commentedon Oct 26, 2026
Warnings kinda do exists in
tscthough, the compiler just never produces them. There isdiagnostic.categoryand it's properly handled by the cli and lsp. The pipeline sometimes assumes that all diagnostics are errors, but that's an easy fix.Adding this will add the new semantics of "errors fail the build, warnings don't" which is not a concept that existed before, but I think it's the most normal thing ever.
Also, it might be a little weird that the compiler itself never produces warnings but content mappers can. Although the weird part is really that the typescript compiler doesn't have warnings.
I can make a PR, this is a small change