From 4ef0f061e6d1700bbbf86291cfaf1a07ae07627f Mon Sep 17 00:00:00 2001 From: Greg Price Date: Tue, 13 Jul 2021 19:40:14 -0700 Subject: [PATCH] api types [nfc]: Make a bogus `empty` explicit. This is the type Flow was already inferring here, as a result of, ultimately, `fetch` having a type of `any` in the libdef RN provides. Make it a little more explicit that that's happening. --- src/api/apiFetch.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api/apiFetch.js b/src/api/apiFetch.js index a23ec324170..f496c9b437d 100644 --- a/src/api/apiFetch.js +++ b/src/api/apiFetch.js @@ -37,12 +37,13 @@ export const apiFetch = async ( params: $Diff<$Exact, {| headers: mixed |}>, ) => fetch(new URL(`/${apiVersion}/${route}`, auth.realm).toString(), getFetchParams(auth, params)); +/** (Caller beware! Return type is the magic `empty`.) */ export const apiCall = async ( auth: Auth, route: string, params: $Diff<$Exact, {| headers: mixed |}>, isSilent: boolean = false, -) => { +): Promise => { try { networkActivityStart(isSilent); const response = await apiFetch(auth, route, params);