react-contenteditable icon indicating copy to clipboard operation
react-contenteditable copied to clipboard

Typescript error on 3.7.5

Open Anahkiasen opened this issue 4 years ago • 1 comments

When I try to use the ContentEditable component with Typescript 3.7.5 I get the following error:

No overload matches this call.
  Overload 1 of 2, '(props: Readonly<Props>): ContentEditable', gave the following error.
    Property 'onChange' is missing in type '{ innerRef: RefObject<HTMLSpanElement>; className: string; tagName: string; html: string; }' but required in type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "ref" | "html" | "style" | "title" | "className" | "children" | "defaultChecked" | ... 251 more ... | "key">'.
  Overload 2 of 2, '(props: Props, context?: any): ContentEditable', gave the following error.
    Property 'onChange' is missing in type '{ innerRef: RefObject<HTMLSpanElement>; className: string; tagName: string; html: string; }' but required in type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "ref" | "html" | "style" | "title" | "className" | "children" | "defaultChecked" | ... 251 more ... | "key">'.  TS2769

Whether I specify onChange doesn't seem to do anything, this seems to be an issue with the use of Modify and DivProps where TS is basically saying you can't add an onChange to a div or something, not sure

Anahkiasen avatar Mar 10 '20 12:03 Anahkiasen

I also have errors in typings:

onScroll?: ((event: React.UIEvent<HTMLDivElement, UIEvent>) => void) | undefined;
onScrollCapture?: ((event: React.UIEvent<HTMLDivElement, UIEvent>) => void) | undefined;

TS2707: Generic type 'UIEvent' requires between 0 and 1 type arguments.

UIEvent has such interface:

interface UIEvent<T = Element> extends SyntheticEvent<T, NativeUIEvent> {
        detail: number;
        view: AbstractView;
    }

f0rmat1k avatar Jul 02 '20 09:07 f0rmat1k