Skip to content
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

React propTypes #185

Open
farism opened this issue Jun 25, 2016 · 2 comments
Open

React propTypes #185

farism opened this issue Jun 25, 2016 · 2 comments

Comments

@farism
Copy link

farism commented Jun 25, 2016

I was looking for a way to validate mori types with React, but I couldn't find a library. So I threw together a package to deal with mori propTypes:

https://github.com/farism/react-mori-proptypes

@jameshopkins
Copy link

jameshopkins commented Jun 25, 2016

Would be great if in the future, Mori provided type definitions (for Typescript, Flow), which would allow type-checking across any interface (React, etc).

Using Flow as an example, in React's case, you could then include the required Mori types in a type alias (along with other native JS data types), which would allow you to validate all props in an elegant interface. E.g:

import type {HashMap} from 'mori/type-defs';

type Props = {
  handleCookieBannerClick: Function,
  whatever: string,
  hashMap: HashMap
};

const MyComponent = (props: Props) => (
  ...
);

@jonsharratt
Copy link

Could really do with flow type definitions 👍 @jameshopkins would be awesome cakes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants