reselect icon indicating copy to clipboard operation
reselect copied to clipboard

Investigate Adding Flow Types

Open ellbee opened this issue 10 years ago • 11 comments

ellbee avatar Jul 07 '16 19:07 ellbee

I've added an initial attempt at this in the flow branch. It concentrates on createSelector. I basically copied the TypeScript typings almost verbatim, and not knowing either of these libraries very well there could be lots of room for improvement.

ellbee avatar Jul 13 '16 19:07 ellbee

I won't be able to help here, unfortunately. I'm not familiar enough with Flow, and there's no support for Windows.

threehams avatar Jul 13 '16 19:07 threehams

@threehams No worries, I'm just happy you can help with the TypeScript stuff!

ellbee avatar Jul 13 '16 20:07 ellbee

Hi all :) I wanted to cover all libraries that I use in work with Flow. Reselect is one of them. I didn't know that task is already in progress so I made my own typings version. https://gist.github.com/RiddleMan/5adf7689bcf3d277473e92ef07961dbb

I'm pretty new with Flow and Open Source (my first contribution).

I think I can start by reviewing your typings and make some comments on them to help land functionality as quick as possible.

RiddleMan avatar Aug 25 '16 09:08 RiddleMan

Hey @RiddleMan, that would be great! Thank you

ellbee avatar Aug 25 '16 09:08 ellbee

@ellbee Ok I analyzed both declaration (mine and yours). Mostly we made this in the same way.

  1. I've spotted that you forgot to pass equalityCheck?: EqualityChecker as second argument of defaultMemoize
  2. createSelectorCreator's first argument is not a selector, but Memoization function which can be just a function.
  3. Of course there is lack of createStructuredSelector

There are 2 ways for resolving that. I can use your flow branch and do a pull request with all flow tests or you can do changes on your own :) I have some time so I can finish your work :)

RiddleMan avatar Aug 25 '16 19:08 RiddleMan

Hey, thanks for that. I don't have a lot of time at the moment so a PR would be very welcome.

When we have a more complete set of declarations, maybe we should also submit to https://github.com/flowtype/flow-typed to get even more eyes on them?

ellbee avatar Aug 25 '16 20:08 ellbee

Ok I've finished work on flow typings. I created some tests and ofc .flow file

I don't know how to proceed to merge this PR #164

RiddleMan avatar Sep 06 '16 08:09 RiddleMan

Reselect has typings in the Flow Typed repo so we won't maintain them here.

ellbee avatar Mar 08 '17 16:03 ellbee

@ellbee Why not doing the same for the Typescript type definition file (moving it in definitelyTyped) ? Even better, for a library like Reselect I think it would be worth having the source files written in Flow or Typescript.

alex3165 avatar Mar 08 '17 16:03 alex3165

And redux is shipped with its declarations too, so reselect could be too.

cf https://github.com/reactjs/redux/tree/master/flow-typed

cr0cK avatar Mar 29 '17 16:03 cr0cK