Narrow jail config types with explicit union values

This commit is contained in:
2026-04-21 19:39:36 +02:00
parent fef8f60ee2
commit 4c313af1c5
5 changed files with 46 additions and 32 deletions

View File

@@ -12,7 +12,7 @@ import {
import { KVEditor } from "./KVEditor";
import { StringListEditor } from "./StringListEditor";
import { useConfigStyles } from "./configStyles";
import type { JailSectionConfig } from "../../types/config";
import type { BackendType, JailSectionConfig } from "../../types/config";
const BACKENDS = ["", "auto", "polling", "gamin", "pyinotify", "systemd"] as const;
@@ -64,7 +64,9 @@ export function JailSectionPanel({ jailName, section, onChange }: JailSectionPan
<Select
size="small"
value={section.backend ?? ""}
onChange={(_e, d) => { update({ backend: d.value || null }); }}
onChange={(_e, d) => {
update({ backend: d.value ? (d.value as BackendType) : null });
}}
>
{BACKENDS.map((b) => (
<option key={b} value={b}>