mirror of
https://github.com/withastro/astro.git
synced 2025-01-06 22:10:10 -05:00
08baf56f32
* feat: allow type `unknown` on `isInputError` * chore: move ErrorInferenceObject to internal utils * chore: changeset * deps: expect-type * feat: first types test * chore: add types test to general test command * refactor: use describe and it for organization
384 B
384 B
astro |
---|
patch |
Expands the isInputError()
utility from astro:actions
to accept errors of any type. This should now allow type narrowing from a try / catch block.
// example.ts
import { actions, isInputError } from 'astro:actions';
try {
await actions.like(new FormData());
} catch (error) {
if (isInputError(error)) {
console.log(error.fields);
}
}