microsoft / microsoft/TypeScript
Import star should work with export type
Offen
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
import star export type
Suggestion
See the code below.
Use Cases
See the code below.
Examples
// a.ts
const a = 1
export type { a } // expected to be used as type only, user case: sharing type rather than value between source code between nodejs and browser
const b = 1
export type { b }
// export other types
// c.ts
import * as c from './a' // to avoid: import { a as a1, b as b1 } from './a'
declare const a: typeof c.a
declare const b: typeof c.b
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
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
Es werden keine Quelldateien, Tests oder Compiler-Einstiegspunkte genannt. Beginne damit, das Beispiel mit a.ts und c.ts mithilfe des TypeScript-Compilers zu reproduzieren, und untersuche, wie export type-Deklarationen und Namespace-Importe behandelt werden. Als erledigt gilt die Aufgabe, wenn die Nur-Typ-Exporte über den Import-Star-Namespace verfügbar sind, ohne dass sich das erzeugte JavaScript ändert.
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
- Klar beschrieben
- Anfängerfreundlichkeit
- 35/100