Flow: `Object.assign`'s type definition seems to be broken.

Created on 30 Mar 2016  路  4Comments  路  Source: facebook/flow

/* @flow */
'use strict'

// property `bar` of object literal. Property not found in object literal
module.exports = exports = Object.assign({foo: true}, {bar: false})

// OR

// property `foo` of object literal. Property not found in object literal
module.exports = exports = Object.assign({}, {foo: true}, {bar: false})

Most helpful comment

Your first error is predicted by object sealing @despairblue -- see https://also.github.io/notes/2016/03/13/flow-object-assign.html, but I might expect the second one to work since the target is unsealed.

All 4 comments

+1, flow gives a hard time with Object.assign

Your first error is predicted by object sealing @despairblue -- see https://also.github.io/notes/2016/03/13/flow-object-assign.html, but I might expect the second one to work since the target is unsealed.

The second example appears to work without any warnings / errors in FlowType 0.36.

This should work in the latest version of Flow. If you are still having issues let us know 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Beingbook picture Beingbook  路  3Comments

bennoleslie picture bennoleslie  路  3Comments

mjj2000 picture mjj2000  路  3Comments

tp picture tp  路  3Comments

jamiebuilds picture jamiebuilds  路  3Comments