@tanstack/react-query
Version:
Hooks for managing, caching and syncing asynchronous and remote data in React
12 lines (10 loc) • 341 B
text/typescript
export function shouldThrowError<T extends (...args: Array<any>) => boolean>(
throwError: boolean | T | undefined,
params: Parameters<T>,
): boolean {
// Allow throwError function to override throwing behavior on a per-error basis
if (typeof throwError === 'function') {
return throwError(...params)
}
return !!throwError
}