File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -14,17 +14,24 @@ export interface AbortError {
14
14
15
15
export type FetchError = NetworkError | AbortError ;
16
16
17
+ /**
18
+ * Represents a function that performs a network request using the Fetch API.
19
+ *
20
+ * @param input - The resource URL or a {@linkcode Request} object.
21
+ * @param init - An optional object containing request options.
22
+ * @returns A promise that resolves to a {@linkcode Result} object containing either a {@linkcode Request} or an error.
23
+ */
17
24
export type RobustFetch = (
18
25
input : RequestInfo | URL ,
19
26
init ?: RequestInit ,
20
27
) => Promise < Result < Response , FetchError > > ;
21
28
22
29
/**
23
- * Performs a network request using the Fetch API .
30
+ * A simple implementation of { @linkcode RobustFetch} that uses { @linkcode fetch} .
24
31
*
25
- * @param input - The resource URL or a ` Request` object.
32
+ * @param input - The resource URL or a { @linkcode Request} object.
26
33
* @param init - An optional object containing request options.
27
- * @returns A promise that resolves to a ` Result` object containing either a `Response` or an error.
34
+ * @returns A promise that resolves to a { @linkcode Result} object containing either a { @linkcode Request} or an error.
28
35
*/
29
36
export const robustFetch : RobustFetch = async ( input , init ) => {
30
37
const request = new Request ( input , init ) ;
You can’t perform that action at this time.
0 commit comments