microsoft / microsoft/TypeScript
Emitter helper function could be override by user code
Open
Nobody has claimed this yet.
Awaiting More Feedback
Suggestion
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Bug Report
🔎 Search Terms
emit, helper
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
⏯ Playground Link
💻 Code
const __extends = () => { throw new Error() }
class B { a = 1 }
class D extends B {}
var d = new D()
console.log(d.a)
🙁 Actual behavior
Exception
🙂 Expected behavior
console.log(1)
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 example and inspect how the compiler emits the __extends helper for the class inheritance code. Reproduce the exception, then trace the emitter's helper handling to determine why the user-defined helper overrides the generated one. Done means the example runs and logs 1 without the user code interfering with the emitted helper.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100