Добрый вечер ,
проблема с дженереками .
export interface Location {
id: number;
address: {
houseNumber: string;
};
}
export const getEuropeLocations = async (
apiKey: string
): Promise<Locations> => {
let response = await axios({
method: "get",
url: `${apiBaseUrl}europe/`,
headers: {
Authorization: `Bearer ${apiKey}`,
},
});
return response.data as Locations;
};
Пытаюсь сделать из getEuropeLocations используя generics :
export const getEuropeLocations = async (
apiKey: string
) => {
let response = await axios.get<Location>({
method: "get",
url: `${apiBaseUrl}europe/`,
headers: {
Authorization: `Bearer ${apiKey}`,
},
});
return response.data;
};
в чем моя ошибка?