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/core has incompatible types with react-redux@8 #976

@sushantdhiman

Description

@sushantdhiman

Describe the bug

Typings are incompatible with latest react-redux@8

node_modules/@rematch/core/dist/types.d.ts:220:97 - error TS2304: Cannot find name 'MapStateToPropsParam'.

220         <RM extends Models<RM>, State, TStateProps, TDispatchProps, TOwnProps>(mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>, mapDispatchToProps: MapRematchDispatchToPropsNonObject<TDispatchProps, TOwnProps, RM>): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps, TOwnProps>;
                                                                                                    ~~~~~~~~~~~~~~~~~~~~

node_modules/@rematch/core/dist/types.d.ts:220:238 - error TS2304: Cannot find name 'InferableComponentEnhancerWithProps'.

220         <RM extends Models<RM>, State, TStateProps, TDispatchProps, TOwnProps>(mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>, mapDispatchToProps: MapRematchDispatchToPropsNonObject<TDispatchProps, TOwnProps, RM>): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps, TOwnProps>;

To Reproduce

If you try to compile any project with skipLibCheck: false using latest dependencies (example below), it will fail type check.

{
  "name": "rematch-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@rematch/core": "^2.2.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-redux": "^8.0.2",
    "redux": "^4.2.0",
    "typescript": "^4.7.4"
  }
}

Expected behavior

Compilation works without any errors

Additional context

Perhaps this type augmentation is no longer required

declare module 'react-redux' {
interface Connect {
<RM extends Models<RM>, State, TStateProps, TDispatchProps, TOwnProps>(
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,
mapDispatchToProps: MapRematchDispatchToPropsNonObject<
TDispatchProps,
TOwnProps,
RM
>
): InferableComponentEnhancerWithProps<
TStateProps & TDispatchProps,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions