v9.0.0
What's Changed?
-
Removal of
create_link_generatorFunctionThe
create_link_generatorfunction has been removed and replaced by a new function,link_generator. Thelink_generatorfunction now accepts aroute_configobject, internally calls theflatten_route_configfunction, and transforms it into aMap. This approach allows for high-speed link generation through the returnedlinkfunction.const route_config = { products: { path: "/products", }, } as const satisfies RouteConfig; const link = link_generator(route_config); link("products"); // => '/products'
-
Deprecation of
flatten_route_configFunctionThe
flatten_route_configfunction was previously public because it enabled easy visual representation of the flattened types while generating thelinkfunction increate_link_generator. It was also meant to save the effort of creating specific type definitions to obtain the flattened types. However, this restricted the ability to make breaking changes to theflatten_route_configfunction. Since thelink_generatorfunction now calls this internally in version 9, there is no longer a need to keep it public. -
Modification of
linkFunction API to Accept Any Number of Query ObjectsThe previous
linkfunction had a limitation where multiple identical query parameters could not be generated. This has been resolved in version 9, and thelinkfunction has been modified to accept any number of query objects starting from the third argument.const route_config = { products: { path: "/products?color&size", } } as const satisfies RouteConfig; const link = link_generator(route_config); link('products', undefined, { color: 'red' }, { color: 'blue' }, { color: 'green', size: 'small' }); // => /products?color=red&color=blue&color=green&size=small
-
Improved Code Readability
Variable and function names used internally have been clarified to enhance code readability.