mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-24 23:07:25 +08:00
removed any type
This commit is contained in:
parent
47ab36ce9b
commit
dd46292636
1 changed files with 13 additions and 8 deletions
|
|
@ -1,17 +1,22 @@
|
|||
type SetFunction = (...params: any[]) => any;
|
||||
type SetFunction<T> = (param: T, nosave?: boolean) => boolean;
|
||||
|
||||
let settingsMemory: {
|
||||
[key: string]: { value: any; setFunction: SetFunction };
|
||||
} = {};
|
||||
type SettingsMemory<T> = {
|
||||
[key: string]: {
|
||||
value: T;
|
||||
setFunction: SetFunction<T>;
|
||||
};
|
||||
};
|
||||
|
||||
export function save(
|
||||
let settingsMemory: SettingsMemory<MonkeyTypes.ConfigValues> = {};
|
||||
|
||||
export function save<T extends MonkeyTypes.ConfigValues>(
|
||||
settingName: string,
|
||||
value: any,
|
||||
setFunction: SetFunction
|
||||
value: T,
|
||||
setFunction: SetFunction<T>
|
||||
): void {
|
||||
settingsMemory[settingName] ??= {
|
||||
value,
|
||||
setFunction,
|
||||
setFunction: setFunction as SetFunction<MonkeyTypes.ConfigValues>,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue