4 ms·
The following example written in TS works in Flow too: type MyComponentProps = { prop1: string; prop2?: number; } type MyComponentState = {
by ggregoire 9y ago
The following example written in TS works in Flow too:
type MyComponentProps = {
prop1: string;
prop2?: number;
}
type MyComponentState = {
foo: number;
bar: string;
baz: number;
}
class MyComponent extends Component<MyComponentProps, MyComponentState> {
Same syntax.
Also, not sure how this could be more straightforward.
- ralmidani 9y agoThank you. I edited my comment after looking at the Flow website. My incorrect understanding came from seeing the atrocious "block comment Flow annotations" in CoffeeScript 2 (an otherwise adorable language) and thinking that was how you had to specify parameter types with Flow.