core-api: bring in RouteRef type from core-plugin-api to make them type compatible
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/core-api': patch
|
||||
---
|
||||
|
||||
Made the `RouteRef*` types compatible with the ones exported from `@backstage/core-plugin-api`.
|
||||
@@ -30,6 +30,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/config": "^0.1.4",
|
||||
"@backstage/core-plugin-api": "^0.1.0",
|
||||
"@backstage/theme": "^0.2.6",
|
||||
"@material-ui/core": "^4.11.0",
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
import { IconComponent } from '../icons/types';
|
||||
import { getOrCreateGlobalSingleton } from '../lib/globalObject';
|
||||
import { RouteRef as NewRouteRef } from '@backstage/core-plugin-api';
|
||||
|
||||
export type AnyParams = { [param in string]: string } | undefined;
|
||||
export type ParamKeys<Params extends AnyParams> = keyof Params extends never
|
||||
@@ -34,7 +35,11 @@ export type RouteFunc<Params extends AnyParams> = (
|
||||
...[params]: Params extends undefined ? readonly [] : readonly [Params]
|
||||
) => string;
|
||||
|
||||
export const routeRefType: unique symbol = getOrCreateGlobalSingleton<any>(
|
||||
type RouteRefType = Exclude<
|
||||
keyof NewRouteRef,
|
||||
'params' | 'path' | 'title' | 'icon'
|
||||
>;
|
||||
export const routeRefType: RouteRefType = getOrCreateGlobalSingleton<any>(
|
||||
'route-ref-type',
|
||||
() => Symbol('route-ref-type'),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user