1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/common/utils/sync-box/sync-box-injection-token.ts
Sebastian Malton b7a2bb5385 Respond to PR comments
- Revert changes to structure of electronTrayInjectable

- Add some behavioural tests for the tray icon

Signed-off-by: Sebastian Malton <sebastian@malton.name>
2022-06-07 11:30:47 -04:00

27 lines
716 B
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectionToken } from "@ogre-tools/injectable";
import type { IComputedValue } from "mobx";
type AsJson<T> = T extends string | number | boolean | null
? T
: T extends Function
? never
: T extends Array<infer V>
? AsJson<V>[]
: T extends object
? { [K in keyof T]: AsJson<T[K]> }
: never;
export interface SyncBox<TValue> {
id: string;
value: IComputedValue<AsJson<TValue>>;
set: (value: AsJson<TValue>) => void;
}
export const syncBoxInjectionToken = getInjectionToken<SyncBox<any>>({
id: "sync-box",
});