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 errors when using this in class method argument defaults #2820

Closed
nrser opened this issue Nov 16, 2016 · 2 comments
Closed

flow errors when using this in class method argument defaults #2820

nrser opened this issue Nov 16, 2016 · 2 comments

Comments

@nrser
Copy link

nrser commented Nov 16, 2016

this sort of thing works in babel-land:

class A {
  x: string;
  
  constructor(x: string) {
    this.x = x;
  }
  
  f(x = this.x) {
    // ...
  }
}

but flow (using v0.35.0) doesn't like it (seems to see this as the global object). maybe this is an anti-pattern of sorts, but it's quite convenient; would be nice if it type-checked.

@vkurchatkin
Copy link
Contributor

See: #1234

@nrser
Copy link
Author

nrser commented Nov 16, 2016

thanks. did some searches but didn't see that one.

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

No branches or pull requests

2 participants