Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Aug 2, 2025. It is now read-only.
This repository was archived by the owner on Aug 2, 2025. It is now read-only.

rematch/select - store.select types incorrect #866

@andrejpavlovic

Description

@andrejpavlovic

Describe the bug
Adding selectors to a model and then trying to use them, gives unexpected typing.

For example, assuming we have myModel with a total selector, one would expect that selection type of the code below to be (state: any) => {total: number}, but instead it is actually (state: any) => {total: (state: any) => number}.

const selection = store.select((models) => ({
  total: models.myModel.totalIds
}));

Reproduce Link
https://codesandbox.io/s/rematch-select-wrong-typing-5tw4w?file=/src/index.ts

To Reproduce

  1. Go to reproduce link
  2. Scroll to bottom of index.ts file
  3. See the typescript error.

Expected behavior
Selector value should not be a function that expects model state that returns the value.

Screenshots
2021-02-18_231008

Desktop

  • OS: Win10
  • Browser: edge
  • Version: 88

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions