2727. Is Object Empty ¶ TypeScript 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15type JSONValue = | null | boolean | number | string | JSONValue[] | { [key: string]: JSONValue }; type Obj = Record<string, JSONValue> | JSONValue[]; function isEmpty(obj: Obj): boolean { if (Array.isArray(obj)) { return obj.length === 0; } return Object.keys(obj).length === 0; }