From 9f478bb46a48eab018a2cdccbedd40726b117a88 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 4 Feb 2021 21:10:13 +0100 Subject: [PATCH] web: fix type warnings --- web/src/api/Client.ts | 4 +++- web/src/elements/router/Route.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/web/src/api/Client.ts b/web/src/api/Client.ts index 583e2946c..3556b0c88 100644 --- a/web/src/api/Client.ts +++ b/web/src/api/Client.ts @@ -13,7 +13,9 @@ export class Client { if (query) { const queryString = Object.keys(query) .filter((k) => query[k] !== null) - .map((k) => encodeURIComponent(k) + "=" + encodeURIComponent(query[k])) + // we default to a string in query[k] as we've filtered out the null above + // this is just for type-hinting + .map((k) => encodeURIComponent(k) + "=" + encodeURIComponent(query[k] || "")) .join("&"); builtUrl += `?${queryString}`; } diff --git a/web/src/elements/router/Route.ts b/web/src/elements/router/Route.ts index 3a52b3559..cafbb7740 100644 --- a/web/src/elements/router/Route.ts +++ b/web/src/elements/router/Route.ts @@ -2,6 +2,7 @@ import { html, TemplateResult } from "lit-html"; export const SLUG_REGEX = "[-a-zA-Z0-9_]+"; export const ID_REGEX = "\\d+"; +export const UUID_REGEX = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"; export class Route { url: RegExp;