endpoints / TypeAlias

ResolveEndpointParamsSchema

Generic types:Schema

Computed type that resolves a EndpointParamsSchema type into an object type that can be used as a parameter to an endpoint function.

See Also

Presentation

type ResolveEndpointParamsSchema = {
  [K in keyof Schema as K extends `${string}?`
    ? never
    : K extends `?${infer N}`
      ? N
      : K]: ContainedTypeOf<Schema[K]>;
} & {
  [K in keyof Schema as K extends `${infer P}?`
    ? P extends `?${infer N}`
      ? N
      : P
    : never]?: ContainedTypeOf<Schema[K]>;
};