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

Class literal properties #2482

Closed
rpominov opened this issue Sep 17, 2016 · 3 comments
Closed

Class literal properties #2482

rpominov opened this issue Sep 17, 2016 · 3 comments

Comments

@rpominov
Copy link

rpominov commented Sep 17, 2016

class Id<T> {
  _x: T;
  constructor(x: T) {
    this._x = x
  }
  static 'fantasy-land/of'<T>(x: T): Id<T> {
    return new Id(x)
  }
}

Flow yields:

11:   static 'fantasy-land/of'<T>(x: T): Id<T> {
      ^ literal properties not yet supported

From error message I understand that Flow team aware about this issue, but I just wanted to give you another use-case (we need this for Fantasy Land) and open an issue to track progress if that's ok.

This should also be added to the list in #560 .

@Jessidhia
Copy link

Sure you don't need the computed property square brackets? static ['fantasy-land/of'] () {}

@rpominov
Copy link
Author

rpominov commented Sep 18, 2016

@Kovensky I think it's valid ES with or without square brackets in this case. At least it works in babel and latest Chrome without them.

With brackets Flow complains as well:

11:   static ['fantasy-land/of']<T>(x: T): Id<T> {
      ^ computed property keys not supported

@calebmer
Copy link
Contributor

calebmer commented Aug 1, 2017

This is a known issue. We currently don’t support it, but we should be adding support in the future 👍

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

3 participants