次のコードは、RTK クエリを使用して Redux フックを作成します。
export const specialtiesApi = createApi({
reducerPath: 'specialtiesApi',
baseQuery: fetchBaseQuery({ baseUrl: 'https://someplace.com/' }),
endpoints: (builder) => ({
getSpecialties: builder.query({
query: (name) => `specialties`,
}),
}),
});
export const { useGetSpecialtiesQuery } = specialtiesApi;
コードの最後の行は、Typescript コンパイル時エラーをスローします。
Property 'useGetSpecialtiesQuery' does not exist on type 'Api<BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, { getSpecialties: QueryDefinition<...>; }, "specialtiesApi", never, unique symbol>'
私のコードは、Typescript 4.3.5 を使用してhttps://redux-toolkit.js.org/rtk-query/usage-with-typescriptから変更されています。
何が悪いのかわかりません。何か案は?