summaryrefslogtreecommitdiff
path: root/apps/web/src/actions/keybindings/migrations/v4-to-v5.ts
blob: f6937c39815d32378841ec60bcab33bfad1b8a32 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import type { KeybindingConfig } from "@/actions/keybinding";

interface V4State {
	keybindings: KeybindingConfig;
	isCustomized: boolean;
}

export function v4ToV5({ state }: { state: unknown }): unknown {
	const v4 = state as V4State;
	const keybindings = { ...v4.keybindings };

	if (!keybindings.escape) {
		keybindings.escape = "deselect-all";
	}

	return { ...v4, keybindings };
}