google / google/closure-compiler
Add compiler warnings/errors for things that are questionable/illegal inside arrow functions
Open
enhancement
ES6
P2
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
See https://github.com/nzakas/understandinges6/blob/master/manuscript/02-Functions.md :
1. Arrow functions are not `new`able.
2. You cannot change the `this` value in an arrow function (with bind/call/apply) which means `(x => y).bind(z)` doesn't do what the user probably intended, and we should warn about it.
3. Arrow functions may not reference `arguments`.
For the first item, we can just make it illegal to annotate an arrow function with `@constructor` since we already have a "tried to `new` a non-constructor" warning.
Contributor guide
Assessment
This issue has not been assessed yet.