microsoft / microsoft/TypeScript

tsc with allowJs reports TS9005 error for nested anonymous constructor functions

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

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

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

説明

🔎 Search Terms

TS9005: Declaration emit for this file requires using private name '(Anonymous function)'. An explicit type annotation may unblock declaration emit.

🕗 Version & Regression Information
  • Occurs on versions 3.7.5 - nightly
  • Related to PR #55472

Related to #55172
When 2 separate nested this bindings are used within constructor functions, the following error's returned always at the top of the file (this was really annoying to debug 😅)

Declaration emit for this file requires using private name '(Anonymous function)'. An explicit type annotation may unblock declaration emit.
⏯ Playground Link

https://tsplay.dev/NV57Gw

💻 Code
const a = new function () {
	this.b = new function () {
		this.c = 1
	}
}
🙁 Actual behavior

Complains

🙂 Expected behavior

Shouldn't complain

Additional information about the issue

No response

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

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

はじめの一歩

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

調査の方向性

リンクされた TypeScript Playground の再現例から始め、関連する宣言出力の動作について PR #55472 と issue #55172 を読んでください。allowJs を使用したネストされた匿名コンストラクターの例で TS9005 が報告されなくなり、宣言出力が引き続き成功すれば、作業は完了です。

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

評価

技術スタック
javascript, typescript
領域
compilers
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

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

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