web: fix type warnings

This commit is contained in:
Jens Langhammer 2021-02-04 21:10:13 +01:00
parent 7a16f97908
commit 9f478bb46a
2 changed files with 4 additions and 1 deletions

View file

@ -13,7 +13,9 @@ export class Client {
if (query) { if (query) {
const queryString = Object.keys(query) const queryString = Object.keys(query)
.filter((k) => query[k] !== null) .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("&"); .join("&");
builtUrl += `?${queryString}`; builtUrl += `?${queryString}`;
} }

View file

@ -2,6 +2,7 @@ import { html, TemplateResult } from "lit-html";
export const SLUG_REGEX = "[-a-zA-Z0-9_]+"; export const SLUG_REGEX = "[-a-zA-Z0-9_]+";
export const ID_REGEX = "\\d+"; 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 { export class Route {
url: RegExp; url: RegExp;