Giter Site home page Giter Site logo

Comments (6)

satya164 avatar satya164 commented on May 18, 2024 3

@grabbou I've been thinking about this and I think we'll need to setup a prepublish script which transpiles these flow annotations to propTypes before publishing

from react-native-paper.

grabbou avatar grabbou commented on May 18, 2024 1

However, we shouldn't get rid of PropTypes, because not everyone uses Flow, so runtime warnings will be useful for them.

Wouldn't a babel plugin to rewrite flow types to prop types solve that problem? That way, we could reduce the overheat of keeping two ways of describing the components API in favour of a single source of truth. The problem that I see here is that both of these provide a slightly different syntax for describing things like lists, arrays or optional values and it's rather easy to provide inconsistencies.

Here's a reference implementation: https://github.com/brigand/babel-plugin-flow-react-proptypes

from react-native-paper.

ahmedlhanafy avatar ahmedlhanafy commented on May 18, 2024

@satya164 I think you're more eligible to answer that

from react-native-paper.

satya164 avatar satya164 commented on May 18, 2024

Flow is certainly superior because it'll provide static type checking and autocompletion. It's also much easier to grasp than prop types in terms of documenting code. It can be used on the CI to prevent unintentional bugs.

However, we shouldn't get rid of PropTypes, because not everyone uses Flow, so runtime warnings will be useful for them.

I think we need to enforce both Flow and PropTypes for now. We should setup CI so that we don't break Flow on master.

from react-native-paper.

ahmedlhanafy avatar ahmedlhanafy commented on May 18, 2024

Does this need to be open? @satya164

from react-native-paper.

satya164 avatar satya164 commented on May 18, 2024

We've not arrived at a conclusion, so yes.

from react-native-paper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.