microsoft / microsoft/TypeScript

`esModuleInterop` breaks circular imports

オープン
#33,012 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Bug Domain: ES Modules
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

TypeScript Version: 3.5.2

Search Terms:

Code

./tsconfig.json:

{
    "compilerOptions": {
        "esModuleInterop": true
    },
    "files": ["./src/main.ts"]
}

./src/main.ts

import { other } from './other';

console.log(other.foo1);

./src/other.ts

export const foo1 = 1;
export const foo2 = 2;

// Import *this* module as a namespace
// Unexpected error:
// Circular definition of import alias 'other'
import * as other from './other';

// Re-export the namespace as a named export
export { other };

(For context on why you might do this: it allows you to give namespace imports a common name.)

Expected behavior:

No error

Actual behavior:

Error (see code comment)

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

./tsconfig.json、src/main.ts、src/other.ts を使い、TypeScript 3.5.2 または該当する現行バージョンで診断を再現します。まず、src/other.ts の namespace import に対する循環インポートエイリアスチェックを追跡します。完了の条件は、想定される import と再エクスポートの動作を維持したまま、報告されたエラーなしで例をコンパイルできることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
compilers
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。