Typing commands for extended nodes #5827
Replies: 3 comments
-
@arrocke Hello, I am trying to do the exact same thing. Do you mind sharing if you managed to solve it? Thank you 🙏 |
Beta Was this translation helpful? Give feedback.
-
I never did solve it and am no longer at the job where this was an issue. One thing I was going to try and didn't get the chance was to use patch-package to remove the global types defined by the tiptap package so that I could define my own. |
Beta Was this translation helpful? Give feedback.
-
An easy fix is to re-declare all of BaseLink’s commands alongside your new one. For example:
This is a bit annoying to do but there's no easier way that I could come up with right now. Ideally, the extension’s command types would be exported so you could import and extend them without duplicating all the built-in commands. But for now, this re-declaration is the straightforward option. |
Beta Was this translation helpful? Give feedback.
-
I extended the Link node extension to add a command
openLinkModal
which as it says opens a modal to edit the current link. However when I try to type the command, I get a typescript errorSubsequent property declarations must have the same type...
. I don't want to change the node name, or copy the extension into my source code. We've got other extensions, far more complicated that this problem applies to where those aren't going to be viable options. Anybody have ideas?Here is the extension file:
Beta Was this translation helpful? Give feedback.
All reactions