You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For those experimenting with Redux Toolkit v2 (currently 2.0.0-Beta.0) and must export their own type declarations, there are quite a few issues with the portability of types from Redux Toolkit Query’s function createApi..
(There are also issues with functions like createSlice too, but I haven’t delved as deep into it, so I’m just focusing on createApi right now.)
The inferred type of 'myApi' cannot be named without a reference to '../node_modules/@reduxjs/toolkit/dist/query/core/module.js'. This is likely not portable. A type annotation is necessary. ts(2742)
Note: I believe this error does not occur for a majority of developers using RTK because it's normally included in applications that don’t need compiled declarations (declarations: false in tsconfig.json). This may be why this issue isn’t frequently brought to attention.
The text was updated successfully, but these errors were encountered:
For those experimenting with Redux Toolkit v2 (currently 2.0.0-Beta.0) and must export their own type declarations, there are quite a few issues with the portability of types from Redux Toolkit Query’s function
createApi
..(There are also issues with functions like
createSlice
too, but I haven’t delved as deep into it, so I’m just focusing oncreateApi
right now.)Using
createApi
...results in an error like so…
Significant TypeScript configurations:
Minimal Example with Error
https://codesandbox.io/p/sandbox/rtk-type-portability-j99lyh?file=%2Fsrc%2Frtk%2FmyApi.ts%3A1%2C1
Note: I believe this error does not occur for a majority of developers using RTK because it's normally included in applications that don’t need compiled declarations (
declarations: false
intsconfig.json
). This may be why this issue isn’t frequently brought to attention.The text was updated successfully, but these errors were encountered: