microsoft / microsoft/TypeScript
Specialized error message when too new a lib is provided
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
🔍 Search Terms
lib es2024 es2025 esnext
✅ 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
If a lib value is provided that's an ES* version newer than what the current version of TypeScript supports, it'd be nice to have a specialized error message saying so. Today we just get the general "Argument for '--lib' option must be: ..." error with >=59 unique values to read through. It would be nice to explicitly indicate the lib is an ES* that's not yet supported. Maybe...
Error: npm error tsconfig.json(3,13): error TS####: Argument 'ES2027' for '--lib' option is a year not yet supported by TypeScript as of version 5.6.7.
📃 Motivating Example
In practice, if a single package in a monorepo falls out of date, then this error is likely to occur. Having that specialized error can help speed up debugging & make it clear what's going wrong.
Example in the wild: https://github.com/eslint/js/pull/631 -> https://github.com/eslint/js/actions/runs/11017802958/job/30596589705?pr=631 -> https://github.com/eslint/js/pull/632
💻 Use Cases
- What do you want to use this for? - Purely for debugging incorrect TS setups.
- What shortcomings exist with current approaches? - The error is accurate, but not precise.
- What workarounds are you using in the meantime? - Remembering to check the ES year & TypeScript version every time this comes up.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the TypeScript compiler's --lib option handling and its existing diagnostic tests; compare the generic invalid-value path with the ES-year case. Done means an unsupported ES* year receives a dedicated diagnostic identifying it as newer than the supported TypeScript version, with coverage for the tsconfig.json scenario.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100