Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spread breaks exact object types #3608

Closed
ForbesLindesay opened this issue Mar 29, 2017 · 1 comment
Closed

Spread breaks exact object types #3608

ForbesLindesay opened this issue Mar 29, 2017 · 1 comment

Comments

@ForbesLindesay
Copy link
Contributor

The following example:

/* @flow */

const x: {|a: number|} = {a: 10};
const y: {|a: number, b: number|} = {...x, b: 10};

Produces the error:

4: const y: {|a: number, b: number|} = {...x, b: 10};
                                       ^ object literal. Inexact type is incompatible with exact type
4: const y: {|a: number, b: number|} = {...x, b: 10};
            ^ exact type: object type

but it shouldn't produce an error because x is an exact object, so spreading it into an object literal should not prevent that object literal being exact.

@vkurchatkin
Copy link
Contributor

Duplicate of #2405

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants