-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
UpdateDefinitions
type not exported from @reduxjs/toolkit/dist/query/endpointDefinitions
#4492
Comments
@joekrill Can you show what your |
@aryaemami59 this is my {
"compilerOptions": {
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noUncheckedIndexedAccess": true,
"strict": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"rootDir": "src",
"declaration": true,
"declarationMap": true,
"outDir": "build",
"sourceMap": true,
"allowJs": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"jsx": "react-jsx",
"lib": ["dom", "dom.iterable", "esnext"],
"target": "es2020",
"composite": true,
"preserveWatchOutput": true,
"skipLibCheck": true
},
"include": ["src/**/*"],
"exclude": ["build/"]
} |
Can you run this command and try again to see if it fixes the issue: npm install https://pkg.csb.dev/reduxjs/redux-toolkit/commit/06a30ee4/@reduxjs/toolkit |
@aryaemami59 That build seems to have fixed the issue! Should I hold off on creating a PR to explicitly export the |
@joekrill That would be up to the maintainers but I would rather not export a type unless we absolutely have to. |
I'm seeing a similar problem with the lack of A dumb workaround I have is to import and export import { UpdateDefinitions } from '@reduxjs/toolkit/dist/query/endpointDefinitions';
import { myApi as api } from './api';
export { UpdateDefinitions };
export const myApi = api.enhanceEndpoints({});
Actually, this only suppresses the error, but types are still wrong. It looks like the problem happens when |
@aryaemami59 Well the reason I ask is because if the changes in the branch you asked me to try will eventually get merged, then that seems to fix the problem and there would be no need for me to create an additional PR for it. So I guess what I'm really asking is: do you expect the changes in that branch to make it into master? |
@joekrill yeah, Arya's been doing a lot of good work fixing up the various TS interop issues. I haven't had time yet to review any of them myself, but sounds like they're pretty close at this point. |
@joekrill Yes. That PR is ready. It just needs to be reviewed and yes I expect it will get merged at some point. |
@mchill The issue is you should not be importing anything from the |
Totally agree, and I'm not directly, but the generated type of import("@reduxjs/toolkit/query").Api<import("@reduxjs/toolkit/query").BaseQueryFn<string | FetchArgs, unknown, import("@reduxjs/toolkit/query").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query").FetchBaseQueryMeta>, import("@reduxjs/toolkit/dist/query/endpointDefinitions").UpdateDefinitions<{}, never, never>, string, never, typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/dist/query/react").reactHooksModuleName>; Both Maybe there's something I should be doing differently to generate better types. I did find a real workaround by setting {
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@reduxjs/toolkit/dist/*": ["node_modules/@reduxjs/toolkit/dist/*"]
}
}
} Haven't tried out your PR yet, but hopefully that fixes it. |
@mchill Can you try out the PR and let me know if it fixes the issue you're having? |
It does! But it introduced another type error when adding
|
@mchill Can you share the code snippet? And are you sure you're not importing from the |
Sure, here's a very stripped down example. Definitely no dist imports. |
@mchill Thanks for the repro, I fixed the issue, can you try this and let me know if it fixes the problem? npm install https://pkg.csb.dev/reduxjs/redux-toolkit/commit/51afa9fc/@reduxjs/toolkit |
Everything looks good to me with that version. |
I'm trying to upgrade to Redux Toolkit v2 but running into a problem that I'm pretty sure is caused by the
UpdateDefinitions
type not being exported from@reduxjs/toolkit/query
.I have a monorepo with a separate package for my API endpoint, which is further split up into smaller chunks.
@reduxjs/toolkit
is a peer dependency in that package.I have a base API defined like this:
And the additional API chunks are handled similar to this:
This was working fine with v1, but after trying to upgrade to v2 I'm getting the error (at the
authApi
definition):If I remove the
enhanceEndpoints
call (and leave just theinjectEndpoints
call) the issues goes away, but then I can no longer use the "Permissions" tag inprovideTags
. I'm fairly certain I've narrowed down the problem to the fact that theUpdateDefinitions
type used byenhanceEndpoints
is not exported by@reduxjs/toolkit/query
. All the other referenced types seem to be exported except for this one. Is there a specific reason for omitting it? Or was it an oversight? Would it be worth me putting up a PR to export it?The text was updated successfully, but these errors were encountered: