microsoft / microsoft/TypeScript

Add Command-Line Syntax-Only Validation

Offen
#37,634 0 Kommentare 5 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

Keywords I searched:

  • Syntax
  • Validation

Suggestion

I would like to see a command line option that makes tsc only validate the syntax of TypeScript (and possibly JavaScript) files within the project, but does not perform type checking. It would not emit any files.

Use Cases

  • (My current use case) TypeScript generated by code generation programs that skips generation of certain symbols, or needs to import symbols from other modules where those modules may not be available yet, so their types cannot be known. The generated files would almost always have type-related errors that cannot reliably be automatically fixed, so just validation of the syntax alone would be helpful.
  • Certain CI/CD workflows could benefit from the lower overhead of just checking syntax only in large projects for every commit, and only performing type checking for commits that are expected to result in a build.

Examples

The command

tsc --noTypeCheck index.ts

could return the normal errors and exit code that it would if the syntax were incorrect, but never check typing.

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 beim tsc-Befehlszeileneinstiegspunkt und überprüfe, wie Syntaxdiagnosen, Typprüfung und das Ausgeben derzeit ausgewählt werden. Definiere die unterstützten Dateimodi der Option und verifiziere, dass sie Syntaxfehler mit dem normalen Exit-Status meldet und dabei Typprüfung und Ausgabe unterdrückt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

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

Neue Issues direkt in Ihr Postfach

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