question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Emitter helper function could be override by user code

See original GitHub issue

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

https://www.typescriptlang.org/play?target=1#code/MYewdgzgLgBA+nApgDyosATCMC8MAUAlLgHwwDeMUAFgE4gDuMYiTAorfbUTAL4CwAKCHAANgEMI2AEIUY43DACMfERKkwAIjBRpMMigOGCAbuNowMilk01ER4CCFGIAdKJABzfBlfjCQA

💻 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)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
Kingwlcommented, Mar 19, 2021

We may add a flag what if the flag turns on, tsc will rename the emitted helper name if there are conflicts in a file?

0reactions
hardfistcommented, Mar 24, 2021

It really seems like this is the bundler’s fault; there are other scenarios where code taking a dependency on a global could get “blocked” by a hoisted declaration later in the same lexical block. Even mangling is not going to really work here since we would have no way of knowing what other names are in scope since those come from later bundles outside the knowledge of the current compilation.

the bundler comes before compilation , so ts compilation should know all the info about scope name conflict

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Inheritance and overriding for private helper methods
I'm guessing that virtual / override don't come into play because validate() is a private method. I know I could also rename the...
Read more >
Calling helper functions in a Python `__init__` function
But, in this case, I'd personally move all of that initialization code out of the class - I'd create a plain data structure...
Read more >
Writing emitters - Cadl - Microsoft Open Source
Cadl emitters are libraries that use various Cadl compiler APIs to reflect on the cadl compilation and produce generated artifacts.
Read more >
Mixins - The Modern JavaScript Tutorial
There's no inheritance, but a simple method copying. So User may inherit from another class and also include the mixin to “mix-in” the ......
Read more >
Scripting API Reference | StudioEventEmitter - FMOD
StudioEventEmitter ::OverrideMinDistance Value to use for the Event Instances ... StudioEventEmitter::SetParameter Helper functions to set parameters on the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found