Skip to content

Release 1.0.4

Compare
Choose a tag to compare
@tomas-light tomas-light released this 02 Feb 12:56
· 8 commits to main since this release

Features:

  • add type constraints for parametrized urls
 import { createNiceWebRoutes } from 'nice-web-routes';

const routes = createNiceWebRoutes({
  user: {
    // typed parameter
    form: (form: 'create' | 'edit') => ({}),
  },
});

routes.user.form('create').url(); // '/user/create'
routes.user.form('edit').url(); // '/user/edit'
routes.user.form('something').url(); // error because it violates type constraint of 'create' | 'edit' | undefined

Breaking changes:

  • renamed UrlBuilderImpl to urlBuilderImpl in FactoryConfig