microsoft / microsoft/TypeScript

JS typedef merged with default export class behaves strangely

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

@sandersn がすでに取り組んでいます。

2026年8月28日 から。

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

説明

TypeScript Version: 3.4.0-dev.201xxxxx

Search Terms:

Code

class Cls {
    x = 12;
    static y = "ok"
}
export default Cls;
/**
 * @typedef {string | number} default
 */

with checkJs and allowJs on reports no errors, however on usage:

import Def from "./file.js"

type Q = Def;

console.log(Def);

the quick info is pretty comprehensive:
image
however the type usage is equal to string | number (okay, maybe that's reasonable, how are a typedef and a class even merging anyway), however there's an error on the value usage:

'Def' only refers to a type, but is being used as a value here

Expected behavior:
An error on the attempted merge (a class and a type alias should be overlapping in symbol flags domains) and for the value usage to resolve to the class, probably.

Actual behavior:
The incongruent behavior described above.

cc @sandersn

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

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

はじめの一歩

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

評価

この issue はまだ評価されていません。

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

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