microsoft / microsoft/TypeScript

Provide type coverage metrics

Offen
#36,802 5 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
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

Search Terms

  • type coverage
  • flow coverage

Suggestion

I'd love it if TypeScript had a tool to capture type coverage metrics, similar to Flow's Type Coverage feature. That coverage data could be used by IDEs (again, currently supported by Flow) to highlight gaps in type coverage. Basically, it should tell us which parts of our code are being evaluated as any.
Assuming it would work like Flow's feature, this could be a separate tsc option or separate cli command. Theirs works for single files and also offers a batch-coverage command for checking directories / whole projects, etc.

Use Cases

  • The Type Coverage metric could be used much like test coverage info, helping us to identify gaps in our typing (particularly unexpected gaps caused by insufficient type definitions from library code).

Examples

Checklist

My suggestion meets these guidelines:

  • 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, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

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 Durchsicht der in diesem Issue verlinkten Dokumentation zu Flow Type Coverage und batch-coverage und untersuche anschließend, wie die tsc-Optionen oder CLI-Befehle von TypeScript gleichwertige Metriken bereitstellen könnten. Als abgeschlossen gilt die Aufgabe, wenn gemeldet wird, welche Teile des Codes für einzelne Dateien sowie für die Abdeckung eines Verzeichnisses oder des gesamten Projekts als any ausgewertet werden, und zwar mit von IDEs nutzbaren Daten.

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
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

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