Flow: new.target support

Created on 4 Dec 2015  路  6Comments  路  Source: facebook/flow

Flow breaks if you give it:

var x = new.target

It tells me that the "." is an unexpected token.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new.target

ES2015+ help wanted

All 6 comments

TIL. added it to #560 too.

Even get this error even with option: suppress_comment (flow v0.23.0) eg.

// $FlowIssue: https://github.com/facebook/flow/issues/1152
if (new.target === BaseClass) {
  throw TypeError("new of abstract class BaseClass");
}

Is there any update on this one? I am like @rogchap, suppress_comment seems not to work with it.

The following is a parse error 0.38.0:

function a(x = new.target){}

I found no evidence it should be forbidden and both Firefox and Node read it without error.

I'm still getting this problem:

./node_modules/flow-bin/flow-osx-v0.40.0/flow check
src/components/SigmaReactGraph.js:40
 40:     if (new.target === MacroNode) {
             ^^^^^^^^^^ not (sup)ported

I'm still getting this problem:

./node_modules/flow-bin/flow-osx-v0.40.0/flow check
src/components/SigmaReactGraph.js:40
 40:     if (new.target === MacroNode) {
             ^^^^^^^^^^ not (sup)ported

Same. What's the recommended way to do this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cubika picture cubika  路  3Comments

mmollaverdi picture mmollaverdi  路  3Comments

doberkofler picture doberkofler  路  3Comments

ghost picture ghost  路  3Comments

jamiebuilds picture jamiebuilds  路  3Comments