-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
ALL properties are optional - but Flow complains about assigning an empty object #5688
Comments
Does an inexact type and |
@idiostruct Good to know there is a workaround! However, the original construct should work, the type definition is fulfilled by an empty object. |
This looks to be related to #4582 The same workaround should work for you though. It's not exactly exact, but it gets the job done in most situations: type OptionsType = {
optional1?: number,
optional2?: boolean,
optional3?: boolean,
[any]: empty
}; |
See my previous comment :-) My focus is on the big report, I can always find some workaround - even if it is to go through |
This is a duplicate bug report of #4582 |
This probably can be closed. |
Flow Try Link
Code:
Error message:
It works when I use
{ .... }
instead of{| .... |}
for the type definition, but I don't want that because then using a non-existent property would work too (example:demo({foo:1});
would not cause an error message either). I declared ALL properties as optional, therefor assigning an empty object should not cause an error.The text was updated successfully, but these errors were encountered: