Skip to content

Commit

Permalink
fix types.
Browse files Browse the repository at this point in the history
  • Loading branch information
sainthkh committed Jul 19, 2022
1 parent ddfb518 commit 6a37a5d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/network/lib/uri.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const DEFAULT_PROTOCOL_PORTS = {
'http:': '80',
} as const

type Protocols = keyof typeof DEFAULT_PROTOCOL_PORTS

const DEFAULT_PORTS = _.values(DEFAULT_PROTOCOL_PORTS) as string[]

const portIsDefault = (port: string | null) => {
Expand Down Expand Up @@ -74,7 +76,7 @@ export function addDefaultPort (urlToCheck: any) {
/* @ts-ignore */
delete parsed.host
if (parsed.protocol) {
parsed.port = DEFAULT_PROTOCOL_PORTS[parsed.protocol]!
parsed.port = DEFAULT_PROTOCOL_PORTS[parsed.protocol as Protocols]
} else {
/* @ts-ignore */
delete parsed.port
Expand Down

0 comments on commit 6a37a5d

Please sign in to comment.