From 17fa6aff3156aadccb2215cd7f6b47f8263ec8c9 Mon Sep 17 00:00:00 2001 From: sunilyadav840 Date: Tue, 25 May 2021 17:54:25 +0530 Subject: [PATCH] fixed typescript strict GremlinSimpleClient file --- .../GraphExplorerComponent/GremlinSimpleClient.ts | 10 +++++----- tsconfig.strict.json | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.ts b/src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.ts index e61f81964..5e5ac6297 100644 --- a/src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.ts +++ b/src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.ts @@ -12,7 +12,7 @@ export interface GremlinSimpleClientParameters { password: string; successCallback: (result: Result) => void; progressCallback: (result: Result) => void; - failureCallback: (result: Result, error: string) => void; + failureCallback: (result: Result | null, error: string) => void; infoCallback: (msg: string) => void; } @@ -62,7 +62,6 @@ export class GremlinSimpleClient { private static readonly requestChargeHeader = "x-ms-request-charge"; public params: GremlinSimpleClientParameters; - private protocols: string | string[]; private ws: WebSocket; public requestsToSend: { [requestId: string]: GremlinRequestMessage }; @@ -72,6 +71,7 @@ export class GremlinSimpleClient { this.params = params; this.pendingRequests = {}; this.requestsToSend = {}; + this.ws = GremlinSimpleClient.createWebSocket(this.params.endpoint); } public connect() { @@ -117,7 +117,7 @@ export class GremlinSimpleClient { } } - public decodeMessage(msg: MessageEvent): GremlinResponseMessage { + public decodeMessage(msg: MessageEvent): GremlinResponseMessage | null { if (msg.data === null) { return null; } @@ -280,7 +280,7 @@ export class GremlinSimpleClient { public static utf8ToB64(utf8Str: string) { return btoa( - encodeURIComponent(utf8Str).replace(/%([0-9A-F]{2})/g, function (match, p1) { + encodeURIComponent(utf8Str).replace(/%([0-9A-F]{2})/g, function (_match, p1) { return String.fromCharCode(parseInt(p1, 16)); }) ); @@ -305,7 +305,7 @@ export class GremlinSimpleClient { return binaryMessage; } - private onOpen(event: any) { + private onOpen(_event: any) { this.executeRequestsToSend(); } diff --git a/tsconfig.strict.json b/tsconfig.strict.json index 53cf90d99..8b828a32a 100644 --- a/tsconfig.strict.json +++ b/tsconfig.strict.json @@ -8,6 +8,7 @@ "noUnusedParameters": true }, "files": [ + "src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.ts", "./src/AuthType.ts", "./src/Bindings/ReactBindingHandler.ts", "./src/Common/ArrayHashMap.ts", @@ -148,4 +149,4 @@ "src/Terminal/**/*", "src/Utils/arm/**/*" ] -} +} \ No newline at end of file