VSCode неправильно отображает возвращаемый тип
Есть такой код:
import axios, { AxiosInstance } from 'axios';
const instance: AxiosInstance = axios.create(
{
baseURL: `${ process.env.REACT_APP_API_URL }`,
}
);
interface IResponseLoginAuth
{
id: string;
title: string;
firstName: string;
lastName: string;
email: string;
role: string;
created: string;
isVerified: boolean;
accessToken: string;
}
interface IApi
{
login: ({ email, password }: { email: string, password: string; }) => Promise<IResponseLoginAuth>;
}
export const api: IApi =
{
login: async ({ email, password }) =>
{
return (
await instance.post('/auth/authenticate', { email, password })
).data;
}
};
Получается мне нужно явно указать тип?
return (
await instance.post('/auth/authenticate', { email, password })
).data as IResponseLoginAuth;
