function isObject(x: unknown): x is Record<string, unknown> {
return typeof x === 'object' && x !== null
}
isObject({}) // β true
isObject(null) // β falseA proper isObject guard checks typeof === 'object' AND x !== null, since typeof null is 'object'.
Challenge: Implement isObject(x: unknown): x is Record<string, unknown>.
Arrays and null should return false.
isObject({}) // β true
isObject([]) // β false (arrays are not plain objects)
isObject(null) // β false (typeof null === 'object' β a classic JS gotcha)