Microsoft/TypeScript
在 GitHub 查看Generated d.ts includes implicit any for recursive types
Open
#55,832 创建于 2023年9月22日
Domain: Declaration EmitHelp WantedPossible Improvement
仓库指标
- Star
- (48,455 star)
- PR 合并指标
- (平均合并 6天 17小时) (30 天内合并 9 个 PR)
描述
🔎 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
💻 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