Hi, I am using the prosemirrror-test-builder library in typescript. My code works just fine in js
const {p,doc,div} = builders(schema,{ p:{nodeType:"paragraph"}, div:{nodeType:"div"}})
export const flatNodes = () => doc(p({id:"1"},"hello"),p({id:"2"}," world"))
but when using typescript I get this error:
TS2345: Argument of type ‘{ id: string; }’ is not assignable to parameter of type ‘string | TaggedProsemirrorNode | TaggedFlatObject’. Object literal may only specify known properties, and ‘id’ does not exist in type 'TaggedProsemirrorNode | TaggedFlatObject
This is my schema
export default new Schema({
nodes: {
text: {},
paragraph: {
attrs: {
id: {}
},
content: "text*",
toDOM() { return ["p", 0]; },
parseDOM: [{ tag: "p" }]
},
div: {
attrs: {
id: {}
},
content: "paragraph*",
toDOM() { return ["div", 0]; },
parseDOM: [{ tag: "div" }]
},
doc: {
attrs: {
id: {
default:"0"
}
},
content: "(paragraph|div)*" }
}
});