You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, i'm currently trying to use the vanilla-jsoneditor package on a react typescript project and faced this small problem.
I've used the base react example as shown on the README of this repo to start trying some stuff in the library, I added all corresponding types and this is my end result
however, whenever I try to use this editor on another component, the property onRenderContextMenu seems to be missing on the type definitions:
for now, if anyone is having this same issue, this is how I managed to fix it:
import{ContextMenuItem,// add this importJSONEditorasEditor,JSONEditorPropsOptional,RenderContextMenuContext// add this import}from'vanilla-jsoneditor';typeOnRenderContextMenu=(items: ContextMenuItem[],context: RenderContextMenuContext)=>ContextMenuItem[]|undefined;typeJSONEditorProps=JSONEditorPropsOptional&{onRenderContextMenu?: OnRenderContextMenu|undefined;};
and then use JSONEditorProps as the type for the properties in your component.
The text was updated successfully, but these errors were encountered:
Hello, i'm currently trying to use the vanilla-jsoneditor package on a react typescript project and faced this small problem.
I've used the base react example as shown on the README of this repo to start trying some stuff in the library, I added all corresponding types and this is my end result
however, whenever I try to use this editor on another component, the property
onRenderContextMenu
seems to be missing on the type definitions:for now, if anyone is having this same issue, this is how I managed to fix it:
and then use
JSONEditorProps
as the type for the properties in your component.The text was updated successfully, but these errors were encountered: