So i'm having the no-unsafe-any linting error on Typescript when trying to get a custom header from my header variable.
It is defined in this interface:
export interface AxiosResponse<T = any> {
data: T;
status: number;
statusText: string;
headers: any;
config: AxiosRequestConfig;
request?: any;
}
and when trying to get a custom id am getting this error like this:
case HttpStatusCode.SeeOther: {
const errorMessage: string =
(err.response.data as GenericError).message ||
err.response.statusText;
if (err.response.headers.id && event) {
apiResponse = ResponseBuilder.seeOther(
requestContext,
HttpStatusCode.SeeOther,
errorMessage,
{
location: `${event.requestContext.resourcePath}/${err.response.headers.id}`,
}
);
I have tried several ways but i cannot make it work.
ERROR: (no-unsafe-any) utilities.ts[159, 40]: Unsafe use of expression of type 'any'. ERROR: (no-unsafe-any) utilities.ts[159, 41]: Unsafe use of expression of type 'any'.