chore: fix types

This commit is contained in:
Henry
2024-04-23 09:13:04 +01:00
parent 4e344a5ae1
commit 0c1de23a19
11 changed files with 80 additions and 45 deletions

31
src/types/contenteditable.d.ts vendored Normal file
View File

@@ -0,0 +1,31 @@
declare module "react-contenteditable" {
import React from "react";
type ChangeEventHandler<T = Element> = (event: React.ChangeEvent<T>) => void;
type KeyUpHandler<T = Element> = (event: React.KeyboardEvent<T>) => void;
type KeyDownHandler<T = Element> = (event: React.KeyboardEvent<T>) => void;
interface ContentEditableProps extends React.HTMLAttributes<HTMLDivElement> {
html: string;
onChange?: ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;
onBlur?: () => void;
onKeyUp?: KeyUpHandler<HTMLTextAreaElement | HTMLInputElement>;
onKeyDown?: KeyDownHandler<HTMLTextAreaElement | HTMLInputElement>;
disabled?: boolean;
tagName?: string;
className?: string;
style?: React.CSSProperties;
innerRef?:
| React.RefObject<HTMLElement>
| ((instance: HTMLElement | null) => void);
placeholder?: string;
}
class ContentEditable extends React.Component<ContentEditableProps> {}
interface ContentEditableElement extends HTMLElement {
value: string;
}
export default ContentEditable;
}