Function: buildPath()
buildPath(
path,params):string
Builds a path by replacing path parameters with their values. The params object is type-checked to match the parameters in the path string.
Parameters
path
string
Path template with parameters like /api/$orgId/test
params
Record<string, string | number>
Object containing parameter values matching the path template
Returns
string
Resolved path with parameters substituted
Example
buildPath('/users/$userName', { userName: 'john-doe' })
// Returns: '/users/john-doe'
// Type error if parameter is missing:
buildPath('/users/$userName', {}) // Error: Property 'userName' is missing