microsoft / microsoft/TypeScript

skipLibChecks specificity

Aperta
#63,397 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Needs Proposal Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

🔍 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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia esaminando la proposta e il comportamento attuale delle opzioni del compilatore skipLibCheck e skipDefaultLibCheck. L’issue non indica file né test, quindi individua prima la gestione delle opzioni del compilatore e la relativa copertura dei test, prima di decidere tra pattern glob o altri design. Il lavoro è completato quando il controllo dei file di dichiarazione può essere gestito in modo granulare mantenendo i vantaggi prestazionali indicati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
compilers
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.