Skip to main content

ParamArg

Extract the Arg type variable from a Param type.

This utility type is useful for implementing custom parameters whose type is in some way based on the type of another parameter. An example is the optional parameters implemented by @snout/router-path-extras.

import { Param, ParamArg } from "@snout/router-path";

type ParamA = Param<"a", string | number>; // a parameter type using an Arg union type
type Arg = ParamArg<ParamA>; // the extracted Arg type is string | number