-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Proposal: different compilation targets es6, es7, es8 and so on #5198
Comments
You can use the |
Thank you @GeoffreyBooth! Sorry maybe I was not clear but I mean coffeescript compiler does not compile to lates modern JS now. And I cannot upgrade JS level with babel. I can only downgrade. I.e. if I have es6 I cannot make it es7 with babel. I can only make it es5 and lower. So my problem is I want to have output JS like this:
instead of
Do I miss something? |
When new features are added to JavaScript, CoffeeScript lags behind and adds support for them after they're standardized. You're referring to class fields: #4552 It happens that CoffeeScript already supports arbitrary code in a class body, not just assignments, which makes it look like CoffeeScript supports class fields. |
Ok. Thank you @GeoffreyBooth!
is on prototype level and shared between instances. But what about methods?
|
This isn’t currently valid JavaScript: class Test {
getAll = () => {
return []
}
} You’re using experimental features here. See Babel REPL. This is because you’re defining the method via class Test
getAll: ->
[] There’s also no benefit to using My suggested CoffeeScript outputs as: var Test;
Test = class Test {
getAll() {
return [];
}
}; Which I think should function identically to your desired output. |
Thank you @GeoffreyBooth! This was bad example without this inside method. But of course I meant cases when we use I know I need babel to transpile class properties. But this is my feature request to target different ES versions and let other tool to do the rest or in some cases we need to use latest node or chrome and all these features are supported by them. |
CoffeeScript supports targeting various ES versions through the |
Choose one: is this a bug report or feature request?
Feature request
Expected Behavior
Compile CS to different JS standards or at least to latest standard instead of just es6.
Current Behavior
Compilation target is es6 only now.
Possible Solution
Probably
nodes.coffee
can be updated or multiplenodes.coffee
can be created for each compilation targets.Context
It makes sense for me to compile to different targets to be used by different environments. If some environment supports new features we just need to provide JS without additional changes.
Also if needed we can let other tools do the rest.
But I'm not sure about the effort to do it :)
Environment
The text was updated successfully, but these errors were encountered: