RouteFunc
Home > @backstage/core-plugin-api
> RouteFunc
TS magic for handling route parameters.
Signature:
export type RouteFunc<Params extends AnyParams> = (...[params]: Params extends undefined ? readonly [] : readonly [Params]) => string;
References: AnyParams
Remarks
The extra TS magic here is to require a single params argument if the RouteRef had at least one param defined, but require 0 arguments if there are no params defined. Without this we'd have to pass in empty object to all parameter-less RouteRefs just to make TypeScript happy, or we would have to make the argument optional in which case you might forget to pass it in when it is actually required.