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: {