microsoft / microsoft/TypeScript
Unexpected declaration error when using symbols and intersections
オープン
まだ誰も着手していません。
Bug
Domain: Declaration Emit
Help Wanted
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
🔎 Search Terms
- declarations
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about generating declarations.
⏯ Playground Link
💻 Code
// @filename: logger.ts
export const LoggerURI = Symbol("Logger");
export type LoggerService = { foo: string } & {
[LoggerURI]: { bar: string };
};
// @filename: api.ts
import * as Logger from "./logger";
export declare const fnW: <A, B>(a: A) => (b: B) => A & B;
export declare const fn: <A>(a: A) => (b: A) => A;
declare const x: Logger.LoggerService;
// ❌🤯
// Exported variable 'a' has or is using name 'LoggerURI' from external module "file:///logger" but cannot be named.(4023)
export const a = fnW(x);
// ✅
export const b = fn(x);
🙁 Actual behavior
Unexpected type error:
Exported variable 'a' has or is using name 'LoggerURI' from external module "file:///logger" but cannot be named.(4023)
🙂 Expected behavior
No type error. LoggerURI is exported so it can be named.
Additional information about the issue
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Playground のリンクと logger.ts および api.ts の再現から始め、fnW(x) と fn(x) のエクスポートされた結果を比較します。宣言の生成と報告された診断 4023 を確認します。fnW のケースで予期しないエラーが発生せず、使用可能なエクスポート宣言が維持されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100