mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
- Revert changes to structure of electronTrayInjectable - Add some behavioural tests for the tray icon Signed-off-by: Sebastian Malton <sebastian@malton.name>
27 lines
716 B
TypeScript
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",
|
|
});
|