/** * Catch-all type for route params. * * @public */ export type AnyRouteRefParams = { [param in string]: string; } | undefined; /** * @deprecated use {@link AnyRouteRefParams} instead * @public */ export type AnyParams = AnyRouteRefParams; /** * Type describing the key type of a route parameter mapping. * * @public * @deprecated this type is deprecated and will be removed in the future */ export type ParamKeys = keyof Params extends never ? [] : (keyof Params)[]; /** * Optional route params. * * @public * @deprecated this type is deprecated and will be removed in the future */ export type OptionalParams = Params[keyof Params] extends never ? undefined : Params; /** * TS magic for handling route parameters. * * @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. * * @public */ export type RouteFunc = (...[params]: Params extends undefined ? readonly [] : readonly [Params]) => string; /** * Absolute route reference. * * @remarks * * See {@link https://backstage.io/docs/plugins/composability#routing-system}. * * @public */ export type RouteRef = { /** @deprecated access to this property will be removed in the future */ $$routeRefType: 'absolute'; /** @deprecated access to this property will be removed in the future */ params: ParamKeys; }; /** * Descriptor of a route relative to an absolute {@link RouteRef}. * * @remarks * * See {@link https://backstage.io/docs/plugins/composability#routing-system}. * * @public */ export type SubRouteRef = { /** @deprecated access to this property will be removed in the future */ $$routeRefType: 'sub'; /** @deprecated access to this property will be removed in the future */ parent: RouteRef; path: string; /** @deprecated access to this property will be removed in the future */ params: ParamKeys; }; /** * Route descriptor, to be later bound to a concrete route by the app. Used to implement cross-plugin route references. * * @remarks * * See {@link https://backstage.io/docs/plugins/composability#routing-system}. * * @public */ export type ExternalRouteRef = { /** @deprecated access to this property will be removed in the future */ $$routeRefType: 'external'; /** @deprecated access to this property will be removed in the future */ params: ParamKeys; optional?: Optional; };