Skip to content

createStructuredSelector type definitions with auto-infer#454

Closed
toomuchdesign wants to merge 3 commits into
reduxjs:masterfrom
toomuchdesign:autoinfer-createstructuredselector
Closed

createStructuredSelector type definitions with auto-infer#454
toomuchdesign wants to merge 3 commits into
reduxjs:masterfrom
toomuchdesign:autoinfer-createstructuredselector

Conversation

@toomuchdesign
Copy link
Copy Markdown

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Typing feature

What is the current behaviour? (You can also link to an open issue here)

Current createStructuredSelector type definition doesn't provide auto-inferring and need users to explicitly provide generics types.

Typing definitions tested in non-strict mode

See: #428

What is the new behaviour?

Provide a different typing strategy as suggested by @oatkiller.

Updates type definitions tests to run in strict mode

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

Yes.

  1. New types need Typescript > 3.1
  2. New types provide working auto-inferring but expose different custom generics definitions. I'd expect users who provided custom generics to their createStructuredSelector calls to have to remove them in order to compile again with the TS compiler.

Unfortunately I wasn't able to to express the new types in a non-breaking way. It may be that is possible.

Other information:

Parallelly working on a similar solution for re-reselect.

In case this gets merged in future I'd suggest the maintainers to rebuild package-lock.json in commit b9ea429 on their own machines.

Please check if the PR fulfills these requirements:

  • Tests for the changes have been added
  • Docs have been added / updated

@toomuchdesign toomuchdesign force-pushed the autoinfer-createstructuredselector branch from 32f4a04 to a397a6f Compare May 2, 2020 18:04
@codecov
Copy link
Copy Markdown

codecov Bot commented May 2, 2020

Codecov Report

Merging #454 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #454   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           15        15           
=========================================
  Hits            15        15           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 27b5cc3...a397a6f. Read the comment docs.

@eXamadeus
Copy link
Copy Markdown
Contributor

This is a useful one to look at for #485 and #484

@eXamadeus eXamadeus mentioned this pull request Feb 9, 2021
3 tasks
markerikson added a commit to eXamadeus/reselect that referenced this pull request Oct 16, 2021
@markerikson
Copy link
Copy Markdown
Contributor

Closing since this is now included in #486

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.

3 participants