When does an instance of NodeType ever get used?

When does an instance of NodeType ever explicitly get used, or appear, in the source code of a program which uses the ProseMirror modules?

It doesn’t have a constructor, so we can’t create a NodeType instance directly.

The function Schema.node( … ) has the option of accepting an instance of NodeType as an argument. But how would we ever use that feature in our code, if we don’t have the ability to create an instance of NodeType?

I feel I may be misunderstanding something about the structure of ProseMirror.

When you create a Schema instance it’ll create the node type instances for you, and store them in its nodes property. Also, nodes have a type property holding their type as a NodeType instance.

Ok, that confirms how I understood it thanks. The ability to call Schema.node(…) with a NodeType argument is kind of a private method, not meant to be called by users of the library.

No, it’s absolutely fine to do schema.node(schema.nodes.paragraph), or schema.node(myParagraph.type), for example.

Aha - schema.nodes.paragraph. Many thanks!