I've got this code snippet that's currently working:
try {
self.loadingFrameMarkup = true;
const { data }: AxiosResponse<IMarkupFrameData> = yield axios.post<IMarkupFrameData>(
Endpoints.LoadMarkupFrame,
{
studyID: self.studyID,
frameIndex: frameIndex,
}
);
result = {
...data,
layers: data.layers.filter((it) => it),
};
self.loadingFrameMarkup = false;
} catch (error: AxiosError | Error) {
if (error?.response?.status === 401) {
self.state = QueueState.Unauthorized;
} else {
self.state = QueueState.Failure;
}
}
typescript-eslint is flagging an error: Catch clause variable type annotation must be 'any' or 'unknown' if specified.ts(1196) (alias) interface AxiosError<T = unknown, D = any>
What should be the error type in Axios?