David Ly-Gagnon
David Ly-Gagnon

Reputation: 411

React-Flow : Type checking props across React components doesn't work

Has anyone got into this problem lately ?

https://github.com/facebook/flow/issues/1279

I'm on flow 0.5 and my code is similar to that issue except that I'm passing type Props as generics to the component:

type Prop = {
   key1: string
}
class MyComponent extends React.Component<void, Props, void> {...}

Calling : <MyComponent unknownKey="should fail" /> should fail since unknownKey doesn't exists.

Upvotes: 1

Views: 291

Answers (1)

David Ly-Gagnon
David Ly-Gagnon

Reputation: 411

So I figured out my problem. My components have an index.js file for exporting and that file needs to be annotated with flow (// @flow).

Upvotes: 2

Related Questions