From 64b4385d658e393b543bf32d8634fc9ced7a870b Mon Sep 17 00:00:00 2001 From: kshitij Date: Mon, 15 Jul 2024 16:28:32 +0530 Subject: [PATCH] Added lint types --- webapp/src/client/client.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/webapp/src/client/client.ts b/webapp/src/client/client.ts index 0063f77e..0291fd1c 100644 --- a/webapp/src/client/client.ts +++ b/webapp/src/client/client.ts @@ -1,6 +1,8 @@ import {Client4} from 'mattermost-redux/client'; import {ClientError} from 'mattermost-redux/client/client4'; +import {Options} from 'mattermost-redux/types/client4'; + import {Item, TooltipData} from 'src/types/gitlab_items'; import {APIError, ConnectedData, GitlabUsersData, LHSData, SubscriptionData} from 'src/types'; @@ -39,10 +41,10 @@ export default class Client { return this.doGet(`${this.url}/channel/${channelID}/subscriptions`); }; - private async doGet(url: string, headers: Record = {}): Promise { - headers['X-Timezone-Offset'] = new Date().getTimezoneOffset(); + private async doGet(url: string, headers: { [x: string]: string; } = {}): Promise { + headers['X-Timezone-Offset'] = String(new Date().getTimezoneOffset()); - const options = { + const options: Options = { method: 'get', headers, }; @@ -62,10 +64,10 @@ export default class Client { }); } - private async doPost(url: string, body: Object, headers: Record = {}): Promise { - headers['X-Timezone-Offset'] = new Date().getTimezoneOffset(); + private async doPost(url: string, body: Object, headers: { [x: string]: string; } = {}): Promise { + headers['X-Timezone-Offset'] = String(new Date().getTimezoneOffset()); - const options = { + const options: Options = { method: 'post', body: JSON.stringify(body), headers, @@ -86,10 +88,10 @@ export default class Client { }); } - private async doDelete(url: string, headers: Record = {}): Promise { - headers['X-Timezone-Offset'] = new Date().getTimezoneOffset(); + private async doDelete(url: string, headers: { [x: string]: string; } = {}): Promise { + headers['X-Timezone-Offset'] = String(new Date().getTimezoneOffset()); - const options = { + const options: Options = { method: 'delete', headers, }; @@ -109,8 +111,8 @@ export default class Client { }); } - private async doPut(url: string, body: Object, headers: Record = {}): Promise { - headers['X-Timezone-Offset'] = new Date().getTimezoneOffset(); + private async doPut(url: string, body: Object, headers: { [x: string]: string; } = {}): Promise { + headers['X-Timezone-Offset'] = String(new Date().getTimezoneOffset()); const options = { method: 'put',