Skip to content

Commit 0487c4d

Browse files
committed
fixup! client: Add some type annotations
1 parent 25e8352 commit 0487c4d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

client/js/helpers/ajax.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ interface AbortableFetch {
3333
/**
3434
* Passing this function as a Promise handler will make the promise fail when the predicate is not true.
3535
*/
36-
export const rejectUnless =
37-
(pred: (response: Response) => boolean) => (response: Response) => {
36+
export function rejectUnless(pred: (response: Response) => boolean): ((Response) => Response) {
37+
return (response: Response) => {
3838
if (pred(response)) {
3939
return response;
4040
} else {
@@ -43,12 +43,13 @@ export const rejectUnless =
4343
throw err;
4444
}
4545
};
46+
}
4647

4748
/**
4849
* fetch API considers a HTTP error a successful state.
4950
* Passing this function as a Promise handler will make the promise fail when HTTP error occurs.
5051
*/
51-
export const rejectIfNotOkay = (response: Response) => {
52+
export function rejectIfNotOkay(response: Response): Response {
5253
return rejectUnless((response: Response) => response.ok)(response);
5354
};
5455

0 commit comments

Comments
 (0)