forked from kitajs/html
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror-boundary.d.ts
33 lines (28 loc) · 1.01 KB
/
error-boundary.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import type { Children } from '.';
/** A component that adds an error boundary to catch any inner promise rejection. */
export function ErrorBoundary(props: ErrorBoundaryProps): JSX.Element;
/** An error thrown by the ErrorBoundary's `timeout` property. */
export class HtmlTimeout extends Error {}
/**
* The props for the `ErrorBoundary` component.
*
* @see {@linkcode ErrorBoundary}
*/
export interface ErrorBoundaryProps {
/** The async children to render as soon as they are ready. */
children: Children;
/**
* The error boundary to use if the async children throw an error.
*
* The error will be string `timeout` if the rejection was caused by the `timeout`
* property.
*
* If the timeout gets triggered, it will throw an {@linkcode HtmlTimeout} error.
*/
catch: JSX.Element | ((error: unknown) => JSX.Element);
/**
* If we should use the catch error boundary if the children takes longer than the
* timeout. Use `undefined` or `0` to disable the timeout.
*/
timeout?: number;
}