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

createApi from query/react typescript inference failes #4903

Open
SamuelTilly opened this issue Mar 20, 2025 · 1 comment
Open

createApi from query/react typescript inference failes #4903

SamuelTilly opened this issue Mar 20, 2025 · 1 comment

Comments

@SamuelTilly
Copy link

Hi! So this is a bit of a weird issue, and I am not enough of a typescript wiz to figure it out.

I will do my best to try to explain the issue, but basically I have a monorepo with the redux store as its own package. When importing the package to "my app" and looking at the type of my exported api, made with createApi from @reduxjs/toolkit/query/react it returns as any. Trying the same thing with @reduxjs/toolkit/query works as expected.

I have set up a small repo to illustrate the problem. https://codeberg.org/SamuelTilly/redux-ts-issue/src/branch/main

@SamuelTilly
Copy link
Author

As a workaround, I found that exporting with a new object seems to yield the correct type inference export const workaroundReactApi = { ...reactApi };. Feels a bit hacky to do it this way.

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

No branches or pull requests

1 participant