| 1 |
import isNode from "../validators/isNode"; |
| 2 |
import type * as t from ".."; |
| 3 |
|
| 4 |
export default function assertNode(node?: any): asserts node is t.Node { |
| 5 |
if (!isNode(node)) { |
| 6 |
const type = node?.type ?? JSON.stringify(node); |
| 7 |
throw new TypeError(`Not a valid node of type "${type}"`); |
| 8 |
} |
| 9 |
} |