Skip to content

Function: isRecord()

isRecord(value): value is Record<string, unknown>

Narrow value to a plain (non-array) object. Use as a type guard before indexing into / mutating parsed JSON so the access is type-safe.

unknown

value is Record<string, unknown>

if (isRecord(parsed)) parsed.foo = 1;