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

Incorrectly shown error when using exact objec type with all optional attributes #7624

Closed
paul23-git opened this issue Apr 8, 2019 · 2 comments

Comments

@paul23-git
Copy link

Flow version: 0.96.2

Expected behavior

When one creates an exact object type, which contains just optional attributes. And later initializes an object using this type, where no attributes are initialized. I expect this to work, as an "empty" object is obviously a subtype of an object with just optional attributes.

`
type T = {|
value?: ?string,
|}

const t:T = {};`

Actual behavior

Flow returns an error on initializing the object: Cannot assign object literal to t because inexact object literal [1] is incompatible with exact T [2]

@borlaym
Copy link

borlaym commented Dec 9, 2019

Just want to bring some attention to this issue by commenting. The fixes to object spreading unveiled this bug in our codebase.

@gkz
Copy link
Member

gkz commented Oct 27, 2022

@gkz gkz closed this as completed Oct 27, 2022
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

5 participants