coffeescript icon indicating copy to clipboard operation
coffeescript copied to clipboard

V2 translate class has some issue

Open kelvinlee opened this issue 9 years ago • 3 comments

CoffeeScript version 2.0.2

App.coffee

class App extends React.Component
	constructor: (@props)->
		super props
	render: ->
		return (<div>Div</div>)

I use this command coffee --compile --bare --output src/ src/ got app.js

app.js

// Generated by CoffeeScript 2.0.2
var App;
App = class App extends React.Component {
  constructor(props1) {
    super(props); // here is the problem, Is it should be props1?
    this.props = props1;
  }

  render() {
    return <div>Div</div>;
  }

};

Is it the super(props); should be props1?

kelvinlee avatar Nov 04 '17 04:11 kelvinlee

That changed in 1.9.0 (Jan 2015).

vendethiel avatar Nov 04 '17 04:11 vendethiel

Or what you meant to write was super @props, which isn't allowed because JavaScript doesn't permit it.

GeoffreyBooth avatar Nov 04 '17 04:11 GeoffreyBooth

@GeoffreyBooth I was wrong, there should not be @

kelvinlee avatar Nov 04 '17 10:11 kelvinlee