Skip to contentSlop Block

no-known-value-widening

Warning

Do not annotate literals as unknown, object or Record<string, T>. Use satisfies to keep the inferred keys.

const handlers: Record<string, Handler> = {This annotation discards the keys and values TypeScript already knows	start: startHandler,};
const payload: unknown = "ready";This annotation discards the keys and values TypeScript already knows
const tokens: { [key: string]: string } = { primary: "#fff" };This annotation discards the keys and values TypeScript already knows
// ast-grep-ignore: no-known-value-widening-typescript

How to fix

Drop the annotation, or use satisfies Record<string, Handler> to check the shape and keep the known keys.

Empty objects used as accumulators and Record types with a finite key type are allowed.