From 7e74c4bfd1d8ce1dec9eebacbe5d855f3cc57825 Mon Sep 17 00:00:00 2001 From: BluJ Date: Wed, 10 May 2023 10:30:14 -0600 Subject: [PATCH] chore: Update types --- lib/mainFn/Host.ts | 42 ++---------------------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) diff --git a/lib/mainFn/Host.ts b/lib/mainFn/Host.ts index 622a88a..8b50f8c 100644 --- a/lib/mainFn/Host.ts +++ b/lib/mainFn/Host.ts @@ -75,14 +75,6 @@ type SslProtocols = { : never }[keyof KnownProtocols] type NotSslProtocols = Exclude -type OldPortOptionsByKnownProtocol = - (typeof knownProtocols)[T] extends { withSsl: KnownProtocol } - ? BasePortOptions & - ({ noAddSsl: true } | { addSsl?: Partial }) - : BasePortOptions & { addSsl?: AddSslOptions | null } -type OldPortOptionsByProtocol = T extends KnownProtocol - ? OldPortOptionsByKnownProtocol - : PortOptions type PortOptionsByKnownProtocol = | ({ @@ -194,40 +186,10 @@ export class Host { private bindPortForKnownDefaulAddSsl( options: PortOptionsByKnownProtocol, - protoInfo: - | { - readonly secure: false - readonly ssl: false - readonly defaultPort: 80 - readonly withSsl: "https" - } - | { readonly secure: true; readonly ssl: true; readonly defaultPort: 443 } - | { - readonly secure: false - readonly ssl: false - readonly defaultPort: 80 - readonly withSsl: "wss" - } - | { readonly secure: true; readonly ssl: true; readonly defaultPort: 443 } - | { readonly secure: true; readonly ssl: false; readonly defaultPort: 22 } - | { - readonly secure: true - readonly ssl: false - readonly defaultPort: 8333 - } - | { - readonly secure: true - readonly ssl: true - readonly defaultPort: 50051 - } - | { - readonly secure: true - readonly ssl: false - readonly defaultPort: 53 - }, + protoInfo: KnownProtocols[keyof KnownProtocols], ) { if ("noAddSsl" in options && options.noAddSsl) return TRUE_DEFAULT - if ("withSsl" in protoInfo) + if ("withSsl" in protoInfo && protoInfo.withSsl) return { preferredExternalPort: knownProtocols[protoInfo.withSsl].defaultPort, scheme: protoInfo.withSsl,