-
Notifications
You must be signed in to change notification settings - Fork 88
fix(Flow Types): Fixed Flow typing to allow for omitting options when using the options param #315
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
Conversation
This comment has been minimized.
This comment has been minimized.
...plit the Options type to OptionParams and Options so that properties can be independently specified in options
2985922
to
8788d68
Compare
I'm open to adding tests for this PR
@FermiDirak why not just updating the already in place Options type definition (warning: I am new to Flow)
@vvo Flow isn't able to infer default values in a function signature, so when you consume reactElementToJsxString
and use Flow, the Options
argument must be specified with all its properties defined.
The problem with updating the Options
type is that some of the methods in the library require all of options
s properties to be defined. The way to circumvent Flow not inferring defaults is to create a separate type for the function signature.
To avoid the duplication you could use the $Shape
special keyword
Uh oh!
There was an error while loading. Please reload this page.
Currently options are an all or nothing parameter. This means if you want to specify the
tabStop
, you must specify every other option if using Flow. This PR splits theOptions
type toOptionParams
andOptions
so that options can be independently specified when using the options param.