frontend-plugin-api: fix useRouteRef types for optional external route refs
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/frontend-plugin-api': patch
|
||||
---
|
||||
|
||||
Fixed the type for `useRouteRef`, which wasn't handling optional external route refs correctly.
|
||||
@@ -1155,7 +1155,7 @@ export function useRouteRef<
|
||||
TParams extends AnyRouteRefParams,
|
||||
>(
|
||||
routeRef: ExternalRouteRef<TParams, TOptional>,
|
||||
): TParams extends true ? RouteFunc<TParams> | undefined : RouteFunc<TParams>;
|
||||
): TOptional extends true ? RouteFunc<TParams> | undefined : RouteFunc<TParams>;
|
||||
|
||||
// @public
|
||||
export function useRouteRef<TParams extends AnyRouteRefParams>(
|
||||
|
||||
@@ -38,7 +38,7 @@ export function useRouteRef<
|
||||
TParams extends AnyRouteRefParams,
|
||||
>(
|
||||
routeRef: ExternalRouteRef<TParams, TOptional>,
|
||||
): TParams extends true ? RouteFunc<TParams> | undefined : RouteFunc<TParams>;
|
||||
): TOptional extends true ? RouteFunc<TParams> | undefined : RouteFunc<TParams>;
|
||||
|
||||
/**
|
||||
* React hook for constructing URLs to routes.
|
||||
|
||||
Reference in New Issue
Block a user