- Any valid pattern is also valid in
href(pattern)
- Href generation with missing optional variables omits the optional section entirely
let href = createHrefBuilder()
href('products(/:id)', { id: 'remix' }) // /products/remix
// These all used to fail, but are now OK!
href('products(/:id)') // /products
href('products(/:id)', {}) // /products
href('products(/:id)', { id: null }) // /products (type error)
href('products(/:id)', { id: undefined }) // /products (type error)
- Param values may be
string | number | bigint | boolean
and are automatically stringified
let href = createHrefBuilder()
// These used to be a type errors, but are now OK!
href('products(/:id)', { id: 1 }) // /products/1
href('products(/:id)', { id: false }) // /products/false