Flow: Object.defineProperty Property not found in object literal

Created on 20 Nov 2017  路  3Comments  路  Source: facebook/flow

The following code:

let a = {}
Object.defineProperty(a, 'someProp', {
  get() {
    return 42
  }
})

Did I do something wrong or is it a bug?

```
2: Object.defineProperty(a, 'someProp', {
^ Object.defineProperty. Property not found in
2: Object.defineProperty(a, 'someProp', {
^ object literal

Most helpful comment

Sure it's a bug.

See this poor definition.

I tried to improve at a bit (not enough for your case though) but with no success: maintainers are not too fast.

All 3 comments

Sure it's a bug.

See this poor definition.

I tried to improve at a bit (not enough for your case though) but with no success: maintainers are not too fast.

Related: #4742 (Object.create) as well as #285 (from 2015!)

Pointing to this comment especially, too: https://github.com/facebook/flow/issues/4742#issuecomment-326088108

The definition has been updated in the JS lib, but it looks like value is still special-cased somewhere in the ML code.

Was this page helpful?
0 / 5 - 0 ratings