Open machr opened 2 months ago
Catch clause variable type annotation must be 'any' or 'unknown' if specified.
Working on typing an AxiosError in a try/catch block.
The code block in question is
try { const { data: newSubrecipeId } = await axios.post( `/{SAMPLE_REST_API_ENDPOINT}`, ); router.push({ name: 'EditSubrecipe', params: { id: newSubrecipeId }, }); // error.value[id] = ''; } catch (err: AxiosError) {. <--- This line would be great to have translated. What does 'catch' expect if ( axios.isAxiosError(err) && err.response && err.response.status === 422 && err.response.data ) { error.value[id] = err.response.data.message; } else { throw new Error('Something went wrong duplicating Subrecipe'); } }
Update: Found some Documentation around the issue https://fettblog.eu/typescript-typing-catch-clauses/
Error Text
Catch clause variable type annotation must be 'any' or 'unknown' if specified.
Supporting Information
Working on typing an AxiosError in a try/catch block.
The code block in question is
Update: Found some Documentation around the issue https://fettblog.eu/typescript-typing-catch-clauses/