jsoneditor
jsoneditor copied to clipboard
node.path property of onEditable missing in TypeScript definitions
The above solution is failed in angular 14
can you tell me how to implement custom_fields_editable in angular 14? very thanks.
Originally posted by @MichaelPanwenjie in https://github.com/josdejong/jsoneditor/issues/1377#issuecomment-1243374267
the defination is 👍 as below: public onEditable: (node: JsonEditorTreeNode | {}) => boolean | { field: boolean, value: boolean };
node maybe {} sometimes, then it can not write as this:
this.editorOptions.onEditable = function(node) {
if (!node.path) { // this line error
return false;
}
};
Can you help me, thanks again!
I guess the type definitions are not up to date with the actual code, I think they come from definitely typed?
So as a solution, it would be great if someone can create a PR to fix the TypeScript definitions. For the time being you can create up to date type definitions yourself, or add a line // @ts-ignore
above it as a temporary workaround.
I use switch "(( <any > node).field)" instead, it works now. Thanks a lot!
👍
Leaving this open for now, help would be welcome to fix the type definitions.