microsoft / microsoft/TypeScript
`esModuleInterop` breaks circular imports
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
TypeScript Version: 3.5.2
Search Terms:
Code
./tsconfig.json:
{
"compilerOptions": {
"esModuleInterop": true
},
"files": ["./src/main.ts"]
}
./src/main.ts
import { other } from './other';
console.log(other.foo1);
./src/other.ts
export const foo1 = 1;
export const foo2 = 2;
// Import *this* module as a namespace
// Unexpected error:
// Circular definition of import alias 'other'
import * as other from './other';
// Re-export the namespace as a named export
export { other };
(For context on why you might do this: it allows you to give namespace imports a common name.)
Expected behavior:
No error
Actual behavior:
Error (see code comment)
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
Reproduziere die Diagnose mit ./tsconfig.json, src/main.ts und src/other.ts unter Verwendung von TypeScript 3.5.2 oder der jeweils relevanten aktuellen Version. Beginne damit, die Prüfung auf zirkuläre Import-Aliase für den Namespace-Import in src/other.ts nachzuverfolgen; abgeschlossen ist die Aufgabe, wenn das Beispiel ohne den gemeldeten Fehler kompiliert und dabei das erwartete Import- und Re-Export-Verhalten beibehält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- compilers
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 35/100