Skip to main content
Version: 1.x.x

ExtractRouteParams


import { ExtractRouteParams } from "@hyper-fetch/core"

Description

Defined in command/command.types.ts:192

Preview

type ExtractRouteParams<T> = string extends T ? NegativeTypes : T extends `${string}:${infer  Param}/${infer  Rest}` ? { [ k in Param | keyof ExtractRouteParams<Rest> ]: ParamType } : T extends `${string}:${infer  Param}` ? { [ k in Param ]: ParamType } : NegativeTypes;

Structure

string extends T ? NegativeTypes : (T extends `${string}:,${infer Param}/,${infer Rest}` ? [k in Param | keyof ExtractRouteParams<Rest>]: ParamType : (T extends `${string}:,${infer Param}` ? [k in Param]: ParamType : NegativeTypes))