microsoft / microsoft/TypeScript
`export import` of types is not allowed in namespaces when using `erasableSyntaxOnly`
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
export import alias type-only namespaces erasableSyntaxOnly
### 🕗 Version & Regression Information
- I was unable to test this on prior versions because `erasableSyntaxOnly` was just released
### ⏯ Playground Link
https://www.typescriptlang.org/play/?erasableSyntaxOnly=true&ts=5.8.2#code/PTAEBcAsEsGdQO4HsBOBrWBYAUAOwIYC2AprAA74DGxEAnmaaAN46ijEAeZq4oAJsUoAbfChrh6NAGJIkbALygAjDgC+OHCFAAjAK68ocfklK4A5L2ToANKHxCoSXQHNIoaODPwJDALRJcIVpbcFkcAhJyKnFJWAB1D0gAJWJObhReFmw2NJ53QnTeABVQRR9GNQ1sLUN4IyQ0fFpwolIKalAAN3tdRiycrjzKANheADNZUuVK7Bxyuyny2AA6GSQ5yVAORdiEqBTcjOWi1dkgA
### 💻 Code
```ts
// this works
namespace types {
export declare type Foo = 1
}
// but this doesn't work, although it's type-only, too
namespace typesWithReexport {
export import T = types
}
// ignoring the error, generally these should be both accessible
type a = types.Foo
type x = typesWithReexport.T.Foo
```
### 🙁 Actual behavior
`export import` re-exporting a namespace (or namespace member) of a type-only namespace from another type-only namespace results in `This syntax is not allowed when 'erasableSyntaxOnly' is enabled.`
### 🙂 Expected behavior
It should not error.
### Additional information about the issue
@jakebailey asked me to open an issue to track this on bsky: https://bsky.app/profile/jakebailey.dev/post/3ljdc3ou7oc2w
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 verlinkten TypeScript Playground-Reproduktion unter Verwendung von erasableSyntaxOnly und vergleiche den akzeptierten `export declare type`-Namespace mit dem abgelehnten `export import`-Re-Export. Verfolge die Compilerdiagnose für das Namespace-Beispiel und ermittle die relevante Prüfung für erasable syntax. Als erledigt gilt die Aufgabe, wenn das Beispiel den Fehler nicht mehr meldet und gleichzeitig der erwartete Zugriff auf den type-only Namespace erhalten bleibt.
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