core-decorators
core-decorators copied to clipboard
@autobind on classes doesn't work with Typescript
SyntaxError: @autobind can only be used on functions, not: undefined
@autobind class AGreatComponent extends React.Component<{},{}> { ... }
My guess is there's a problem in the class vs function detection algorithm:
https://github.com/jayphelps/core-decorators.js/blob/master/src/autobind.js
function handle(args) { if (args.length === 1) { return autobindClass(...args); } else { return autobindMethod(...args); <-- code is going here instead } }
I'm not sure how to fix it.
I love core-decorators by the way! Made my last project much cleaner. Thanks for your work!