Type helper representing the (optional) Params of a Route path. By extracting string literals starting with a colon (and optionally ending on a question mark), a union type of a key/value pair for each parameter is created.
The Route path string type.
Extract Params from 'item/:id/field/:name?':
'item/:id/field/:name?'
import { type Router } from '@sgrud/shell';const params: Router.Params<'item/:id/field/:name?'>;// { id: string; name?: string; } Copy
import { type Router } from '@sgrud/shell';const params: Router.Params<'item/:id/field/:name?'>;// { id: string; name?: string; }
Generated using TypeDoc
Type helper representing the (optional) Params of a Route path. By extracting string literals starting with a colon (and optionally ending on a question mark), a union type of a key/value pair for each parameter is created.