Giter VIP home page Giter VIP logo

flowtype-hoc-exploration's People

Contributors

pcardune avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

saltycrane

flowtype-hoc-exploration's Issues

Did you see different behavior when used in different files?

Thanks for your notes-- they were really informative for me!

Did you notice different Flow behavior when the code is in different files?

When the code is all in 1 file (Profile.js) here: https://github.com/saltycrane/flowtype-hoc-exploration/tree/fc09e5f3a0eb62d500c31d996a16610ab682f8e1

I get 2 errors as expected:

    $ npm run -s flow
    Profile.js:25
     25:   <LoggedProfile
           ^ React element `LoggedProfile`
     26:     username={1234}
                       ^^^^ number. This type is incompatible with
      6: function Profile(props:{username:string, onEdit:Function}) {
                                          ^^^^^^ string

    Profile.js:25
     25:   <LoggedProfile
           ^ React element `LoggedProfile`
     27:     onEdit={"not implemented yet"}
                     ^^^^^^^^^^^^^^^^^^^^^ string. This type is incompatible with
      6: function Profile(props:{username:string, onEdit:Function}) {
                                                         ^^^^^^^^ function type


    Found 2 errors

Then I modified the code into 2 files (App.js and Profile.js) here: https://github.com/saltycrane/flowtype-hoc-exploration/tree/4e3150217dc62ef960a8b4e80680bee772a14307

And I got this unexpected error:

    $ npm run -s flow
    Profile.js:22
     22: const LoggedProfile = logOnRender(Profile);
                               ^^^^^^^^^^^^^^^^^^^^ type parameter `FirstOrderProps` of function call. Missing annotation


    Found 1 error

Then I separated the code into 3 files (App.js, Profile.js and logOnRender.js) here: https://github.com/saltycrane/flowtype-hoc-exploration/tree/b56850c3cbf95cd9702f3e6fd53adcc4d8e760bc

And I got 0 errors which is not expected:

    $ npm run -s flow
    No errors!

Just wondering if you have seen this. I am using Flow 0.33.0 and Node v6.4.0.

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.