microsoft / microsoft/TypeScript
`export import` of types is not allowed in namespaces when using `erasableSyntaxOnly`
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
### 🔎 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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con la riproduzione collegata in TypeScript Playground usando erasableSyntaxOnly e confronta il namespace `export declare type` accettato con la riesportazione `export import` rifiutata. Segui la diagnosi del compilatore per l’esempio di namespace e individua il controllo rilevante di erasable syntax. Il lavoro è completato quando l’esempio non segnala più l’errore, preservando al contempo l’accesso previsto al namespace di soli tipi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 35/100