-
-
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
fix(RTKQuery): Resolves type portability with createApi. fixes #3568 #3569
fix(RTKQuery): Resolves type portability with createApi. fixes #3568 #3569
Conversation
This branch is running in CodeSandbox. Use the links below to review this PR faster. |
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 8c985cd:
|
✅ Deploy Preview for redux-starter-kit-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
packages/toolkit/src/query/index.ts
Outdated
export { defaultSerializeQueryArgs } from './defaultSerializeQueryArgs' | ||
export * from './tsHelpers'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please try to keep it to a minimum and check what is actually needed. From what I gather, that might actually only be symbol
types.
We don't want to export too much, since at that point implementation details become a public API that we have to try to keep stable and keep supporting pretty much indefinitely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense; you got it! I'll pin point it.
Maybe you're right about the symbols and only coreModuleName
needs to be exposed. TypeScript has a hard time making it clear.
Here's a very simple reproduction of all the portability errors I was seeing in my project:
https://codesandbox.io/p/sandbox/rtk-type-portability-j99lyh?file=%2Fsrc%2Frtk%2FmyApiBaseQuery.ts%3A11%2C3
^ Additional comments in the sandbox to see what might've lead me astray.
a697971
to
33268d9
Compare
You are correct @phryneas, it is just the symbol type that is necessary to resolve this issue. |
33268d9
to
8f02cd8
Compare
While you're at it, could you make sure to export the |
…n exporting declarations in a typescript project
8f02cd8
to
3a1b28d
Compare
Sure thing! |
… typing when including API reducers
7304993
to
8c985cd
Compare
I found additional problems inferring types when using Reproduction of the error on Code Sandbox Exporting the exact types |
This PR had conflicts and I didn't have push permissions, so I duped and rebased over into #3678 . Thanks! |
Exports additional types to resolve the
ts2742
error when using thecreateApi
function from RTK Query.Resolves issue: #3568