Flow version: 0.101.0
I've written a stateless functional React component similar to this:
import React from 'react';
type Props: {
a: number,
b: string,
};
function Component({a, b}: Props): React.Node {
return <div>a is {a} and b is {b}</div>;
}
Component.defaultProps = {
a: 1,
};
export default Component;
I would like to be able to write a Flow libdef for this component so that it can be imported with its default props into another package. But I can't seem to get it to work, no matter how I declare Component. Is there a way to do this?
The linked Try-Flow typechecks correctly
The linked Try-Flow does not recognize the existence of defaultProps on component Component.
This is gonna be fixed in the next release! Update your try-flow link to use the master version and you'll see the error goes away!
Oh perfect timing, thanks!
Most helpful comment
This is gonna be fixed in the next release! Update your try-flow link to use the master version and you'll see the error goes away!