microsoft / microsoft/TypeScript
tsc with allowJs reports TS9005 error for nested anonymous constructor functions
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
🔎 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
💻 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
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 TypeScript Playground reproduction and read PR #55472 and issue #55172 for the related declaration-emit behavior. The work is done when the nested anonymous constructor example with allowJs no longer reports TS9005 while declaration emit still succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100