microsoft / microsoft/TypeScript
TSC should not error on valid subpath specifier syntax (TS2877)
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
🔎 Search Terms
TS2877
🕗 Version & Regression Information
This changed between versions 5.6 and 5.7 (best guess; 5.7 introduced rewriteRelativeImportExtensions).
⏯ Playground Link
💻 Code
// Imports like these cause TS2877,
// when in fact there's nothing wrong about them.
import "#alice.ts";
🙁 Actual behavior
error TS2877: This import uses a '.ts' extension to resolve to an input TypeScript file, but will not be rewritten during emit because it is not a relative path.
🙂 Expected behavior
Don't error.
Additional information about the issue
Specifiers aren't paths. Especially subpath imports and exports allow for almost arbitrary string rewriting. The compiler is blatantly wrong about this.
Edit: I've created a repro repo.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der verknüpften Playground-Reproduktion und dem Repro-Repository und verwende die aufgeführten Compiler-Optionen und die Diagnose TS2877 als Einstiegspunkte. Verfolge, warum der Subpfad-Import '#alice.ts' als nicht umschreibbare Eingabedatei behandelt wird. Als erledigt gilt, dass dieser gültige Specifier nicht mehr TS2877 erzeugt, während das gemeldete Verhalten bei relativen Pfaden intakt bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- compilers
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 64/100