This fails:
// @flow
type A = {|
foo: number
|}
const foo: A = {foo: 3}
const bar: A = {...foo}
With error:
demo.js:8
8: const bar: A = {...foo}
^^^^^^^^ object literal. Inexact type is incompatible with exact type
8: const bar: A = {...foo}
^ exact type: object type
This pattern is pretty common in redux style reducers where you return the old state merged with new values (e.g.{...foo, foo: 4})
This fails:
With error:
This pattern is pretty common in redux style reducers where you return the old state merged with new values (e.g.
{...foo, foo: 4})