-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Namespaced class not working #1319
Comments
Hi @moimael, thanks for the report. Could you give a more complete code example showing the error, ideally as a repl link? If I just run decaffeinate on your code snippet, it gives this output: IZ.Controllers.Page = class Page extends IZ.Controller {}; so I think you'll need a more complete example. Ideally there's a way to trim your code down to a small self-contained test case demonstrating the issue. From the error, it looks to me like maybe Also, would be good to double-check that this case works in the CoffeeScript compiler and doesn't work in decaffeinate. |
Hi, Here you go: The thing is it is used in a rails project so the imports are handled via the rails asset system. |
@alangpierce Anything else I can do to help solve this issue ? |
@moimael I believe this may actually be correct. Your example code in the REPL does not have the same error you initially mentioned ( However, if there really is a problem with decaffeinate that leads to the error you mentioned ( |
Sorry for the radio silence! I just played around with it a bit more. @moimael It looks like you have a subclass with bound methods, so the Babel/TypeScript workaround code is being generated (see the comment In short, you must either set up your build system to use Babel (which you need to do anyway if you want to support IE) or rewrite the code to bind the methods after the super call in the constructor (which changes the behavior, so you might need to rework the code more to fix any resulting bugs). I'd strongly recommend reworking your code, either on the CoffeeScript side to get rid of I wrote up some docs about it here: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md#ds001-remove-babeltypescript-constructor-workaround If that's not the issue, would be good to get more information. |
decaffeinate is producing the wrong JavaScript based on my CoffeeScript input:
I get this output:
Not sure how the javascript should look like but I get this error:
The text was updated successfully, but these errors were encountered: