microsoft / microsoft/TypeScript
`export import` of types is not allowed in namespaces when using `erasableSyntaxOnly`
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
### 🔎 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
コントリビューションガイド
調査の方向性
erasableSyntaxOnly を使用した、リンク先の TypeScript Playground の再現例から始め、受け入れられる `export declare type` namespace と、拒否される `export import` 再エクスポートを比較します。namespace の例に対するコンパイラ診断を追跡し、関連する erasable syntax のチェックを特定します。例がエラーを報告しなくなり、期待される type-only namespace へのアクセスが維持されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 35/100