Я пытаюсь написать службу API в приложении React, используя Ax ios и Typescript.
Это мой код:
interface Service<T> {
GetAll?: Promise<AxiosResponse<T>>;
}
interface Example {
id: Number;
}
const ApiService2 = () => {
const Example = (): Service<Example> => {
const GetAll = (): Promise<AxiosResponse<Example[]>> => {
return axios.get<Example[]>("urlhere");
};
return {
GetAll
};
};
};
И это мой полный ошибка:
Type '() => Promise<AxiosResponse<Example[]>>' is missing the following properties from type 'Promise<AxiosResponse<Example>>': then, catch, [Symbol.toStringTag], finally TS2739