microsoft / microsoft/TypeScript

Specialized error message when too new a lib is provided

Offen
#60,050 0 Kommentare 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Awaiting More Feedback Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

🔍 Search Terms

lib es2024 es2025 esnext

✅ Viability Checklist
⭐ 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
  1. What do you want to use this for? - Purely for debugging incorrect TS setups.
  2. What shortcomings exist with current approaches? - The error is accurate, but not precise.
  3. What workarounds are you using in the meantime? - Remembering to check the ES year & TypeScript version every time this comes up.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne bei der Behandlung der Option --lib des TypeScript-Compilers und den vorhandenen Diagnosetests; vergleiche den generischen Pfad für ungültige Werte mit dem Fall des ES-Jahres. Als erledigt gilt die Aufgabe, wenn ein nicht unterstütztes ES*-Jahr eine eigene Diagnose erhält, die es als neuer als die unterstützte TypeScript-Version ausweist, mit Abdeckung für das tsconfig.json-Szenario.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
compilers
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.