From 6642aef44a67d19ad8f1108e6472f57c00281a4c Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 3 May 2023 11:36:01 -0400 Subject: [PATCH] chore: Fix type errors around backend routes Signed-off-by: Sebastian Malton --- packages/core/src/main/router/route.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/core/src/main/router/route.ts b/packages/core/src/main/router/route.ts index 4989f20731..7849917eec 100644 --- a/packages/core/src/main/router/route.ts +++ b/packages/core/src/main/router/route.ts @@ -10,9 +10,13 @@ import type { LensApiResultContentType } from "./router-content-types"; import type { URLSearchParams } from "url"; import type { SafeParseReturnType } from "zod"; +declare const emptyObjectSymbol: unique symbol; + +export interface EmptyObject {[emptyObjectSymbol]?: never} + export type InferParam< T extends string, - PathParams extends Record, + PathParams, > = T extends `{${infer P}?}` ? PathParams & Partial> @@ -27,12 +31,14 @@ export type InferParamFromPath

= : never : P extends `${infer A}/${infer B}` ? InferParam> - : InferParam>; + : InferParam; export interface LensApiRequest { path: Path; payload: unknown; - params: InferParamFromPath; + params: string extends Path + ? Partial> + : InferParamFromPath; cluster: Cluster | undefined; query: URLSearchParams; raw: {