prefer-total-union-record
Declare a total record for closed registries indexed by a finite string union.
Why
A string index permits a table to omit a union member, so adding a state can silently reach a fallback.
Fix
Use satisfies Record<Key, Value> with the domain union, and supply an entry for each member. Review any fallback separately.
Examples
import type { State } from "./states.js";const LABELS: Record<string, string> = { failed: "Failed", passed: "Passed" };export const label = (state: State) => LABELS[state] ?? "Pending";export type State = "failed" | "passed" | "running";import type { State } from "./states.js";const LABELS = { failed: "Failed", passed: "Passed", running: "Pending",} as const satisfies Record<State, string>;export const label = (state: State) => LABELS[state];export type State = "failed" | "passed" | "running";