microsoft / microsoft/TypeScript

Generated d.ts includes implicit any for recursive types

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

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

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

説明

🔎 Search Terms

recursive any noImplicitAny d.ts

🕗 Version & Regression Information
  • This is the behavior in every version I tried (3.3 through 5.2), and I reviewed the FAQ for entries about anything related to this.
⏯ Playground Link

playground link

💻 Code
const a = () => a;
🙁 Actual behavior

Any is implicitly introduced in the d.ts:

declare const a: () => any;

Note that the local type checking (not using the d.ts) correctly handles this recursive type without introducing "any", and builds fine with noImplicitAny enabled.

🙂 Expected behavior

Either generate something without implicitly introducing any, or generate an error if noImplicitAny is enabled.
In this case, the below code generation for the d.ts would work:

declare const a: () => typeof a;
Additional information about the issue

No response

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

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

はじめの一歩

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

調査の方向性

リンクされた Playground の再現から始め、const a = () => a に対して生成される宣言を、期待される typeof a 形式と比較します。この再帰型の宣言生成パスを追跡し、noImplicitAny の回帰テストを追加または更新します。再帰宣言で暗黙の any が導入されなくなるか、適切なエラーが報告されれば完了です。

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

評価

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

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

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