Skip to content
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

Export ThunkDispatch from redux-thunk. #473

Merged

Conversation

sammyers
Copy link
Contributor

@sammyers sammyers commented Apr 2, 2020

Provide the ThunkDispatch type as an export for developer utility and to fix a nasty TypeScript problem.

Fixes #472 (see the issue for details on what this is solving)

@netlify
Copy link

netlify bot commented Apr 2, 2020

Deploy preview for redux-starter-kit-docs ready!

Built with commit 5a0623a

https://deploy-preview-473--redux-starter-kit-docs.netlify.com

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 2, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 5a0623a:

Sandbox Source
amazing-hermann-rm1y7 Configuration
ecstatic-sky-8q03y Configuration
gracious-wood-kvg3y Configuration

@phryneas
Copy link
Member

phryneas commented Apr 3, 2020

I don't really understand the exact circumstances here, but I think this would definitely not hurt. What do you think @markerikson ?

@markerikson markerikson merged commit 828026d into reduxjs:master Apr 4, 2020
@markerikson
Copy link
Collaborator

Sure.

@VinceOPS
Copy link
Contributor

VinceOPS commented Oct 4, 2022

Good morning @markerikson @phryneas.

I had the exact same problem (#472) with type ThunkMiddleware. Exporting this type from redux-thunk fixes it, just the way @sammyers did it with ThunkDispatch.

The inferred type of 'configureXxxxxStore' cannot be named without a reference to '.pnpm/redux-thunk@2.4.1_redux@4.2.0/node_modules/redux-thunk'. This is likely not portable. A type annotation is necessary.ts(2742)

(context: Monorepo using pnpm, latest RTK and TS 4.8.4, declaration and declarationMap enabled as I am working on a public library).

Don't you mind if I create a PR to add this type to the exported?


The same error occures with createSlice, but related to immer.

The inferred type of 'xxxxxSlice' cannot be named without a reference to '.pnpm/immer@9.0.15/node_modules/immer/dist/internal'. This is likely not portable. A type annotation is necessary.

I could solve the issue, exporting WritableDraft from immer, then exporting it again from RTK (alongside the already exported Draft).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants