In the following code example, the intention is that scrapeMovies
function accepts only serializable objects.
/* @flow */
type SerializableObjectType = {
[key: string]: string | number | boolean | $ReadOnlyArray<SerializableObjectType> | SerializableObjectType
};
type GuideType = {|
rid: string
|};
const guide: GuideType = {
rid: 'foo'
};
const scrapeMovies = async (guide: SerializableObjectType) => {};
scrapeMovies(guide);
I do not comprehend what is the reason flowtype is complaining about scrapeMovies
being fed guide
object, which is less strict definition of a SerializableObjectType
.
Whats the correct way to define a sub-type here?
from What is the correct way to define a subtype in Flow?
No comments:
Post a Comment