Skip to content

Typescript support #38

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

Closed
wants to merge 35 commits into from
Closed

Typescript support #38

wants to merge 35 commits into from

Conversation

nickserv
Copy link
Collaborator

@nickserv nickserv commented Aug 29, 2018

I would appreciate code reviews but please do not merge yet.

  • Strictly type with TypeSscript 3 (does not support TypeScript 2)

  • Use Babel 7 to retain similar build tooling

  • Attempt to make createReducer Action types safe (requires complex mapped types and inference)

  • Set up declaration publishing

  • Finish typing selectorator

  • Fixes Support Redux 4 #28

  • Fixes Typing support #30

@nickserv nickserv mentioned this pull request Aug 29, 2018
@nickserv
Copy link
Collaborator Author

nickserv commented Sep 7, 2018

I think I finally got the action types in a decent state. 😄 The disadvantage is that in TS files createReducer now requires both its generic arguments (state type and union of action types), but it maps each slice reducer's key to the appropriate action type so slice reducer arguments can be inferred. Usage in JS files should be unaffected, though I'm not 100% sure if I got the Babel 7 config working with external helpers properly.

Declaration files are also added to dist in the install script, so types should be published automatically. The normal JS builds still work without the TS compiler or Babel preset.

I'd appreciate a code review, but I still need to finish selectorator before this can be merged.

@nickserv
Copy link
Collaborator Author

nickserv commented Sep 7, 2018

@neurosnap By the way thanks for your advice on createReducer types, here's what I have so far: https://github.com/nickmccurdy/redux-starter-kit/blob/typescript/src/createReducer.ts

@nickserv
Copy link
Collaborator Author

nickserv commented Oct 3, 2018

I'd be happy to update this if we can switch from Selectorator to Reselect

@markerikson
Copy link
Collaborator

Remind me what the specific difficulties are in adding types to Selectorator?

@markerikson
Copy link
Collaborator

@nickmccurdy : ping

What are the specific problems typing Selectorator? Is it primarily the multiple-parameters issue?

What would be your thoughts on cloning Selectorator into the lib, and maybe enforcing only passing the input selectors as an array instead of multiple args?

@markerikson
Copy link
Collaborator

Superseded by #73 .

phryneas added a commit that referenced this pull request Nov 2, 2021
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

Successfully merging this pull request may close these issues.

2 participants