-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
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}
)
AlicanC, pbomb, jfmengels, torifat, wukkuan and 249 more