我收到此错误 ts(2742) 无法在没有所有 rtk 查询操作的引用的情况下命名,我该如何修复它?
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
export const postsApi = createApi({
reducerPath: "api",
baseQuery: fetchBaseQuery({ baseUrl: "url" }),
endpoints: (builder) => ({
getChaptersList: builder.query({
query: () => "/chapters-list/",
}),
getChapter: builder.query({
query: (chapter:string) => `/chapters-list/${chapter}/`,
}),
}),
});
export const {
useGetChaptersListQuery,
useGetChapterQuery
} = postsApi;
The inferred type of 'useGetChapterQuery' cannot be named without a reference to '../../../node_modules/@reduxjs/toolkit/dist/query/react/buildHooks'. This is likely not portable. A type annotation is necessary.ts(2742)
我使用的是 vite 最新版本,我设置了一个旧的 vite 版本,现在我没有这个 ts 错误:]