UNPKG

@kubb/cli

Version:

Command-line interface for Kubb, enabling easy generation of TypeScript, React-Query, Zod, and other code from OpenAPI specifications.

15 lines (13 loc) 360 B
export function getErrorCauses(errors: Error[]): Error[] { return errors .reduce((prev, error) => { const causedError = error?.cause as Error if (causedError) { prev = [...prev, ...getErrorCauses([causedError])] return prev } prev = [...prev, error] return prev }, [] as Error[]) .filter(Boolean) }