I have a type predicate function that is expected to give type to a JSON object
interface Duck {
canQuack: true
}
function isDuck(duck: unknown): duck is Duck {
if (typeof duck !== "object" || ! duck) return false
return duck.canQuack === true
}
But typescript complains that canQuack doesn't exit on object.
How do I do type check on an object with type unknown?