microsoft / microsoft/TypeScript
In JS, JS containers can't be augmented inside an IIFE
Open
Nobody has claimed this yet.
Bug
Domain: JavaScript
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
var Ns = {};
(function () {
Ns.x = 1
})()
Ns.x
Expected behavior:
No errors. Ns.x should be visible inside and outside the IIFE.
Actual behavior:
No errors, but completion dooesn't suggest 'x' as a property of Ns and Ns.x ends up with type any.
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 by running the minimal JavaScript reproduction from the issue and compare the inferred type of Ns.x inside and outside the IIFE. Trace how the type checker handles property augmentation across the function boundary, including completion results. Done means Ns.x is inferred consistently and completion suggests x after the IIFE without errors.
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
- 35/100