Open
Description
let p = #{ x: 11, y: 22 }
function handlePoint(x: unknown) {
if (x instanceof /* ??? */) { // how to determine whether an unknown variable is a specific Record / Tuple
console.log(`x is a point:`, x)
} else {
throw new Error(`x is not a point`)
}
}
try to name #{ x, y }
:
record Point #{ x, y }
const p = Point #{ x: 1, y: 2 }
x instanceof Point
or:
x instanceof #{x, y}
Metadata
Metadata
Assignees
Labels
No labels