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:
Patrik Oldsberg
2021-06-03 00:35:33 +02:00
parent 75bfb62a6a
commit 0160678b18
3 changed files with 12 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core-api': patch
---
Made the `RouteRef*` types compatible with the ones exported from `@backstage/core-plugin-api`.
+1
View File
@@ -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",
+6 -1
View File
@@ -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'),
);