microsoft / microsoft/TypeScript
Generated d.ts includes implicit any for recursive types
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.4k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
🔎 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Playground reproduction and compare the generated declaration for const a = () => a with the expected typeof a form. Trace the declaration-generation path for this recursive type and add or update a regression test for noImplicitAny. Done means recursive declarations no longer introduce implicit any, or an appropriate error is reported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100