plugin-api: clean up todos
Co-authored-by: Juan Lulkin <jmaiz@spotify.com> Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -30,7 +30,6 @@ export type IdentityApi = {
|
||||
*/
|
||||
getUserId(): string;
|
||||
|
||||
// TODO: getProfile(): Promise<Profile> - We want this to be async when added, but needs more work.
|
||||
/**
|
||||
* The profile of the signed in user.
|
||||
*/
|
||||
|
||||
@@ -36,7 +36,7 @@ const makeKey = (id: string) => `__@backstage/${id}__`;
|
||||
export function setGlobalSingleton(id: string, value: unknown): void {
|
||||
const key = makeKey(id);
|
||||
if (key in globalObject) {
|
||||
throw new Error(`Global ${id} is already set`); // TODO some sort of special build err
|
||||
throw new Error(`Global ${id} is already set`);
|
||||
}
|
||||
globalObject[key] = value;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ export function setGlobalSingleton(id: string, value: unknown): void {
|
||||
export function getGlobalSingleton<T>(id: string): T {
|
||||
const key = makeKey(id);
|
||||
if (!(key in globalObject)) {
|
||||
throw new Error(`Global ${id} is not set`); // TODO some sort of special build err
|
||||
throw new Error(`Global ${id} is not set`);
|
||||
}
|
||||
|
||||
return globalObject[key];
|
||||
|
||||
@@ -94,7 +94,7 @@ describe('ExternalRouteRef', () => {
|
||||
const _3 = createExternalRouteRef({ id: '3', params: ['x', 'y'] });
|
||||
// @ts-expect-error
|
||||
validateType<{ x: string }, any>(_3);
|
||||
// TODO(Rugvip): Ideally this would fail as well, but settle for validating it at runtime instead
|
||||
// extra z, we validate this at runtime instead
|
||||
validateType<{ x: string; y: string; z: string }, any>(_3);
|
||||
validateType<{ x: string; y: string }, false>(_3);
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ describe('RouteRef', () => {
|
||||
validateType<undefined>(_2);
|
||||
// @ts-expect-error
|
||||
validateType<{ x: string; z: string }>(_2);
|
||||
// TODO(Rugvip): Ideally this would fail as well, but settle for validating it at runtime instead
|
||||
// extra z, we validate this at runtime instead
|
||||
validateType<{ x: string; y: string; z: string }>(_2);
|
||||
validateType<{ x: string; y: string }>(_2);
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ describe('SubRouteRef', () => {
|
||||
validateType<{ x: string; z: string }>(_2);
|
||||
// @ts-expect-error
|
||||
validateType<{ y: string }>(_2);
|
||||
// TODO(Rugvip): Ideally this would fail as well, but settle for validating it at runtime instead
|
||||
// extra z, we validate this at runtime instead
|
||||
validateType<{ x: string; y: string; z: string }>(_2);
|
||||
validateType<{ x: string; y: string }>(_2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user