Skip to content

Commit d3feb95

Browse files
committed
Remove generic types from KubernetesTunnel
Typing just the protocol isn't enough for true type safety, and the generics were really just getting in the way. Whoever uses this API will have to make sure it's doing the correct things. This is generally the case for the existing API methods anyway.
1 parent 55ccce2 commit d3feb95

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/contract.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ export interface RequestOptions {
2626
expectJson?: boolean;
2727
}
2828

29-
export interface KubernetesTunnel<Tproto extends string> {
29+
export interface KubernetesTunnel {
3030
/** Indicates which network protocol is in use.
3131
* This changes semantics, largely due to Kubernetes tunnel API quirks. */
3232
readonly transportProtocol: 'SPDY' | 'WebSocket' | 'Opaque';
33-
readonly subProtocol: Tproto;
33+
readonly subProtocol: string;
3434
/** Set up a channel, using either SPDY or Websocket semantics. */
3535
getChannel<
3636
Treadable extends boolean,
@@ -53,7 +53,7 @@ export interface KubernetesTunnel<Tproto extends string> {
5353
}
5454

5555
export interface RestClient {
56-
performRequest<Tproto extends string>(opts: RequestOptions & {expectTunnel: Tproto[]}): Promise<KubernetesTunnel<Tproto>>;
56+
performRequest(opts: RequestOptions & {expectTunnel: string[]}): Promise<KubernetesTunnel>;
5757
performRequest(opts: RequestOptions & {expectStream: true; expectJson: true}): Promise<ReadableStream<JSONValue>>;
5858
performRequest(opts: RequestOptions & {expectStream: true}): Promise<ReadableStream<Uint8Array>>;
5959
performRequest(opts: RequestOptions & {expectJson: true}): Promise<JSONValue>;

0 commit comments

Comments
 (0)