microsoft / microsoft/TypeScript

Enable `allowJs` with `isolatedDeclarations`

Offen
#58,262 6 Kommentare 21 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Experience Enhancement
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

Acknowledgement
  • I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.
Comment

Today, an error is issued when allowJs is set alongside isolatedDeclarations - js and ts .d.ts emit use the same pipeline, so it really should work, provided the error generation logic isn't making too many syntax assumptions.

Mostly, unlocking this is going to involve looking through the isolatedDeclarations tests and copying them with their cast/annotation syntaxes swapped to jsdoc and filenames swapped to .js just to give confidence things are going to work OK (and that getEffectiveTypeNode is being used over a direct .type get in enough places in the error generator). There's a few other JS-specific error cases to look at (js's unique export/expression merges, for one) that may need some new errors, but the bulk of it is just ensuring the existing type node presence checking logic generalizes to jsdoc-sourced type nodes.

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 vorhandenen isolatedDeclarations-Tests und des error generator, insbesondere der Verwendungen von getEffectiveTypeNode im Vergleich zum direkten Typzugriff. Dupliziere relevante Fälle mit JSDoc-Annotationen und .js-Dateinamen und untersuche anschließend JavaScript-spezifische Export- und Expression-Merge-Fälle. Erledigt ist die Aufgabe, wenn allowJs mit isolatedDeclarations nicht mehr fälschlicherweise fehlschlägt und die erweiterten Tests erfolgreich sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

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

Neue Issues direkt in Ihr Postfach

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