From 588eaeb2dfd2386399fd6088ac81902a2736e32d Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 2 Dec 2021 20:45:42 -0500 Subject: [PATCH] fix type errors Signed-off-by: Sebastian Malton --- src/common/protocol-handler/error.ts | 4 ++-- src/common/protocol-handler/router.ts | 10 +++++----- src/main/protocol-handler/router.ts | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/common/protocol-handler/error.ts b/src/common/protocol-handler/error.ts index c08d867766..263d5bfe2f 100644 --- a/src/common/protocol-handler/error.ts +++ b/src/common/protocol-handler/error.ts @@ -30,13 +30,13 @@ export enum RoutingErrorType { MISSING_EXTENSION = "missing-ext", } -export class RoutingError extends Error { +export class RoutingError extends Error { /** * Will be set if the routing error originated in an extension route table */ public extensionName?: string; - constructor(public type: RoutingErrorType, public url: Url) { + constructor(public type: RoutingErrorType, public url: Url) { super("routing error"); } diff --git a/src/common/protocol-handler/router.ts b/src/common/protocol-handler/router.ts index c387b18a55..6aea2037d1 100644 --- a/src/common/protocol-handler/router.ts +++ b/src/common/protocol-handler/router.ts @@ -91,7 +91,7 @@ export abstract class LensProtocolRouter extends Singleton { * @param url the parsed URL that initiated the `lens://` protocol * @returns true if a route has been found */ - protected _routeToInternal(url: Url): RouteAttempt { + protected _routeToInternal(url: Url>): RouteAttempt { return this._route(this.internalRoutes.entries(), url); } @@ -101,7 +101,7 @@ export abstract class LensProtocolRouter extends Singleton { * @param routes the array of path schemas, handler pairs to match against * @param url the url (in its current state) */ - protected _findMatchingRoute(routes: Iterable<[string, RouteHandler]>, url: Url): null | [match>, RouteHandler] { + protected _findMatchingRoute(routes: Iterable<[string, RouteHandler]>, url: Url>): null | [match>, RouteHandler] { const matches: [match>, RouteHandler][] = []; for (const [schema, handler] of routes) { @@ -128,7 +128,7 @@ export abstract class LensProtocolRouter extends Singleton { * @param routes the array of (path schemas, handler) pairs to match against * @param url the url (in its current state) */ - protected _route(routes: Iterable<[string, RouteHandler]>, url: Url, extensionName?: string): RouteAttempt { + protected _route(routes: Iterable<[string, RouteHandler]>, url: Url>, extensionName?: string): RouteAttempt { const route = this._findMatchingRoute(routes, url); if (!route) { @@ -166,7 +166,7 @@ export abstract class LensProtocolRouter extends Singleton { * @param url the protocol request URI that was "open"-ed * @returns either the found name or the instance of `LensExtension` */ - protected async _findMatchingExtensionByName(url: Url): Promise { + protected async _findMatchingExtensionByName(url: Url>): Promise { interface ExtensionUrlMatch { [EXTENSION_PUBLISHER_MATCH]: string; [EXTENSION_NAME_MATCH]: string; @@ -222,7 +222,7 @@ export abstract class LensProtocolRouter extends Singleton { * Note: this function modifies its argument, do not reuse * @param url the protocol request URI that was "open"-ed */ - protected async _routeToExtension(url: Url): Promise { + protected async _routeToExtension(url: Url>): Promise { const extension = await this._findMatchingExtensionByName(url); if (typeof extension === "string") { diff --git a/src/main/protocol-handler/router.ts b/src/main/protocol-handler/router.ts index fe178705e7..ffcfd49d3e 100644 --- a/src/main/protocol-handler/router.ts +++ b/src/main/protocol-handler/router.ts @@ -39,7 +39,7 @@ export interface FallbackHandler { * @returns `true` if it should be routed internally to Lens, `false` if to an extension * @throws if `host` is not valid */ -function checkHost(url: URLParse): boolean { +function checkHost(url: URLParse): boolean { switch (url.host) { case "app": return true; @@ -112,7 +112,7 @@ export class LensProtocolRouterMain extends proto.LensProtocolRouter { return false; } - protected async _findMatchingExtensionByName(url: URLParse): Promise { + protected async _findMatchingExtensionByName(url: URLParse>): Promise { const firstAttempt = await super._findMatchingExtensionByName(url); if (typeof firstAttempt !== "string") { @@ -126,7 +126,7 @@ export class LensProtocolRouterMain extends proto.LensProtocolRouter { return ""; } - protected _routeToInternal(url: URLParse): RouteAttempt { + protected _routeToInternal(url: URLParse>): RouteAttempt { const rawUrl = url.toString(); // for sending to renderer const attempt = super._routeToInternal(url); @@ -135,7 +135,7 @@ export class LensProtocolRouterMain extends proto.LensProtocolRouter { return attempt; } - protected async _routeToExtension(url: URLParse): Promise { + protected async _routeToExtension(url: URLParse>): Promise { const rawUrl = url.toString(); // for sending to renderer /**