no-known-value-widening
Preserve a known value's contract instead of widening a local binding to unknown, object, or an unknown-valued dictionary.
Why
Erasing a typed value's fields forces downstream code to rediscover the same contract through casts, reflection, or representation checks.
Fix
Keep the inferred type, select the required domain fields, or use satisfies to check compatibility without erasing evidence.
Examples
type Tool = { name: string; enabled: boolean };declare const tool: Tool;const fields: Record<string, unknown> = tool;type Tool = { name: string; enabled: boolean };declare const tool: Tool;const fields = tool;declare function load(): { id: string };const value: unknown = load();declare function load(): { id: string };const value = load();const handlers: Record<string, () => void> = { start() {} };handlers.start();type Command = "start";const handlers = { start() {} } satisfies Record<Command, () => void>;handlers.start();const value: unknown = { id: "u1" };const value = { id: "u1" };class Store { readonly #value: unknown = { id: "u1" }; read() { return this.#value; }}class Store { readonly #value = { id: "u1" }; read() { return this.#value; }}