Skip to content

ReducerWithInitialState is not portlable according to TS #4108

@krutoo

Description

@krutoo

Hi, in my project i use toolkit 2.0.0 and i have type check build during emit declaration files only with isolatedModules: true option in tsconfig:

{
  "compilerOptions": {
    "target": "ES2021",
    "moduleResolution": "Bundler",
    "baseUrl": ".",
    "jsx": "react-jsx",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "noUncheckedIndexedAccess": true,
    "outDir": "dist/types",
    "declaration": true,
    "sourceMap": true,
    "emitDeclarationOnly": true,
    "isolatedModules": true
  },
  "include": ["src"],
  "exclude": ["node_modules", "*.test.*", "**/__test__/*"]
}

i have error:

src/internal/core/redux/index.ts:64:14 - error TS2742: The inferred type of 'reducer' cannot be named without a reference to '../../../../node_modules/@reduxjs/toolkit/dist/createReducer'. This is likely not portable. A type annotation is necessary.

Can we add export of ReducerWithInitialState from entry point of package?

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