From 07094aabe6306add00001197bd780144c3645bee Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Tue, 15 Mar 2022 14:33:29 -0300 Subject: [PATCH] Chore: Migrate REST API - getServerInfo to Typescript (#3900) --- app/lib/rocketchat/services/connect.ts | 2 +- app/lib/utils.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/lib/rocketchat/services/connect.ts b/app/lib/rocketchat/services/connect.ts index 1cb34d964..07df5c3ed 100644 --- a/app/lib/rocketchat/services/connect.ts +++ b/app/lib/rocketchat/services/connect.ts @@ -379,7 +379,7 @@ async function getServerInfo(server: string) { const response = await RNFetchBlob.fetch('GET', `${server}/api/info`, { ...RocketChatSettings.customHeaders }); try { // Try to resolve as json - const jsonRes = response.json(); + const jsonRes: { version?: string; success: boolean } = response.json(); if (!jsonRes?.success) { return { success: false, diff --git a/app/lib/utils.ts b/app/lib/utils.ts index 3a0e58e12..061367f68 100644 --- a/app/lib/utils.ts +++ b/app/lib/utils.ts @@ -18,7 +18,7 @@ const methods = { }; export const compareServerVersion = ( - currentServerVersion: string | null, + currentServerVersion: string | null | undefined, method: keyof typeof methods, versionToCompare: string ): boolean =>