toggle.ts
1interface Toggleable<T> {
2 inactive: T
3 active: T,
4}
5
6export function toggleable<T>(inactive: T, modifications: Partial<Toggleable<T>>): Toggleable<T> {
7 let active: T = inactive;
8 if (modifications.active !== undefined) {
9 active = { ...inactive, ...modifications.active };
10 }
11 return {
12 inactive: inactive,
13 active: active
14 };
15
16 d
17}