Closed Crypto-zombie closed 1 year ago
I'd also love to see a fix for this. For the time being, you can use module augmentation to add the missing types
// types.d.tsx
declare module 'rctx-contextmenu' {
interface ContextMenu {
children?: ReactNode;
}
interface ContextMenuItem {
children?: ReactNode;
}
interface ContextMenuTrigger {
children?: ReactNode;
}
interface Submenu {
children?: ReactNode;
}
}
Thanks for raising the issue.
This is resolved. Kindly use the latest version (1.4.1). Closing the ticket. Kindly open if it still exist
rctx-contextmenu
version: 1.3.6node
version: v16.17.0npm
(oryarn
) version: 8.15.0Relevant code or config
What you did:
I just tried to run sample code on react-typescript project.
"react": "^18.2.0", "typescript": "^4.7.4",
What happened:
Type '{ children: Element[]; id: string; appendTo: string; animation: string; }' is not assignable to type 'IntrinsicAttributes & ContextMenu'. Property 'children' does not exist on type 'IntrinsicAttributes & ContextMenu'. 3 | const CustomContextMenu = () => { 4 | return (
Suggested solution: I solved this problem like this:
rctx-contextmenu/src/index.d.ts
export interface ContextMenu { id: string, appendTo?: string, animation?: string, hideOnLeave?: boolean, attributes?: object, className?: string, preventHideOnResize?: boolean, preventHideOnScroll?: boolean, onShow?: {(event: any): void}, onHide?: {(event: any): void}, children?: ReactNode, ---------------------------------------> onMouseLeave?: {(event: any): void} }
export interface ContextMenuItem { disabled?: boolean, preventClose?: boolean, disableWhileShiftPressed?: boolean, attributes?: object, className?: string, children?: ReactNode, ----------------------------------------> onClick?: {(event: any): void} }
export interface ContextMenuTrigger { id: string, attributes?: object, disable?: boolean, className?: string, children?: ReactNode -------------------------------------------> }
export interface Submenu { title: string, attributes?: object, className?: boolean, children?: ReactNode --------------------------------------------> }
I would like you to solve this issues as soon as possible. Best Regards
Evgenii