microsoft / microsoft/TypeScript

skipLibChecks specificity

Offen
#63,397 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Needs Proposal Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

🔍 Search Terms

skipLibCheck specific files

✅ Viability Checklist
⭐ Suggestion

Currently skipLibCheck is an all or nothing proposition. You either suppress all errors from declaration files or you get errors from all declaration files. This is not really an accurate reflection of how declaration files are usually used. Almost all projects use declaration files from a trusted source, like npm. Errors from these files are usually not relevant and can be safely suppressed. Many projects however also have declaration files they write by hand (usually for interop with js files, or for libraries that are not typed) - these generally should be type checked since they are actively authored as part of the project.

Ideally skipLibCheck would allow us to more granularly control which declaration files are checked and which are not. This allows us to reap the performance benefits of skipLibCheck while not sacrificing type checking on authored code.

Proposal

One possible solution would be to allow skipLibCheck to be a list of glob patterns for which type checking should be skipped. This would be a simple solution allowing users to decide what declaration files they want and don't want checked.

While this solution is probably the simplest one to implement, we should consider other ones.

📃 Motivating Example

We have a custom build tool that uses the compiler API to force some declaration files to skip checking by setting their hasDefaultLib flag and using skipDefaultLibCheck instead of skipLibCheck. While this solution worked well in the past this is not really a supported solution which we expect will break (6.0 already breaks our current implementation - we have found an alternate implementation, 7.0 will make any sort of custom solution much more difficult)

💻 Use Cases
  1. What do you want to use this for?
    Improve build performance of TypeScript projects.

  2. What shortcomings exist with current approaches?
    You can suppress errors from all declaration files or from none. There is no granular control over it.

  3. What workarounds are you using in the meantime?
    Use the compiler API to control which declaration files are checked.

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 mit der Prüfung des Vorschlags und des aktuellen Verhaltens der Compiler-Optionen skipLibCheck und skipDefaultLibCheck. Da im Issue keine Dateien oder Tests genannt werden, lokalisiere zunächst die Behandlung der Compiler-Optionen und die zugehörige Testabdeckung, bevor du dich zwischen Glob-Mustern oder anderen Designs entscheidest. Als erledigt gilt die Aufgabe, wenn die Prüfung von Declaration-Dateien granular gesteuert werden kann und dabei die genannten Performance-Vorteile erhalten bleiben.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
compilers
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

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