From b2d89820a3ba920fc5a4ea35dad63a857b546346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20=C5=A0mol=C3=ADk?= Date: Tue, 1 Sep 2020 14:24:25 +0200 Subject: [PATCH] Fix ClientOptions types Remove index signature from ChannelOptions to fix intersection error described in #1558 which causes issues on using ClientOptions direct fields with TypeScript. Removing of index signature required few minor changes: - adding few constant types that were used throughout the app - using `as const` assertion in xds-client - using not-so-great type cast in channelOptionsEqual Alternative solution would be removing the index signature from ChannelOptions explicitly in ClientOptions definition, which is not trivial and probably calls for a generic type helper. See: https://github.com/grpc/grpc-node/issues/1558 Fixes: #1558 --- packages/grpc-js/src/channel-options.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/grpc-js/src/channel-options.ts b/packages/grpc-js/src/channel-options.ts index 8c4756ec7..f316a58a0 100644 --- a/packages/grpc-js/src/channel-options.ts +++ b/packages/grpc-js/src/channel-options.ts @@ -33,7 +33,9 @@ export interface ChannelOptions { 'grpc.max_send_message_length'?: number; 'grpc.max_receive_message_length'?: number; 'grpc.enable_http_proxy'?: number; - [key: string]: string | number | undefined; + 'grpc.http_connect_target'?: string; + 'grpc.http_connect_creds'?: string; + [key: string]: any; } /**