Skip to content
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

Flow doesn't like defaulting arguments to this.foo #3353

Closed
ghost opened this issue Feb 7, 2017 · 2 comments
Closed

Flow doesn't like defaulting arguments to this.foo #3353

ghost opened this issue Feb 7, 2017 · 2 comments

Comments

@ghost
Copy link

ghost commented Feb 7, 2017

I'm not sure what the spec says about this, but flow and babel are out of sync here.

class Foo {
  a = 42;
  bar(a = this.a) {
    console.log(a);
  }
}

new Foo().bar()

Flow claims that in the assignment to this.a that this is global. Babel transpiles it to the class instance.

@AugustinLF
Copy link
Contributor

It should be fixed quite soon, there's an open PR #3334 to fix that!

@jeffmo
Copy link
Contributor

jeffmo commented Feb 7, 2017

For posterity, here's my breakdown of the spec confirming Babel's behavior:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants