Closed NiketaNraval90 closed 2 weeks ago
The reason why it doesn't work is because you implemented the constructor incorrectly. There may be other bugs in your code as well, but that is why you're getting this helpful error message. The correct way to subclass is not to copy and paste the constructor's code, it's to call the super's constructor with the arguments that it is expecting.
ListItemNode's constructor has three arguments:
constructor(value?: number, checked?: boolean, key?: NodeKey) {
In your constructor, you're calling it with one argument, which is the wrong type, and is in the wrong position (typescript would catch all of this):
constructor(value, checked, key) {
super(key);
The right solution would be to either delete the constructor in your subclass, because you don't actually have any code in there that's doing useful work, or to correctly call the constructor with all three arguments.
Hi
Thanks, its working now by changing below code and removing constructor.
nodes: [
...ThemeNodes,
ExtendedListItemNode,
{replace: ListItemNode, with: (node) => new ExtendedListItemNode(node.__value, node.__checked)}
],
Adding Style into
ListItemNode
ExtendedListItemNode.jsx
Replace Node
After press the enter below error will ocurre.
Error while adding content after
Can Anyone help me in this.