Adding types to node.attrs

We are using PM + Typescript and I was wondering if there are any recommendable approaches for adding types to the node attributes object.

For example, we have a node type ‘block’ that can hold a fixed set of attributes. Since the node type determines this set of attributes, it would be nice to have some sort of type guard function that returns a typed node.

const isBlockNode = (node: Node): node is Node<Block> => {
  return node.type.name === "block";
}

I guess this would require a generic for Node. Are there any plans on implementing this? Or perhaps an existing solution?

Thanks for the work you are doing!

The library was designed without TypeScript in mind, and that shows in places like this. There are no plans to add type parameters everywhere for this kind of thing (it’d get quite noisy).