1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-17 20:51:20 +02:00

TypeScript Improvement: Use [key: string]: unknown, not [key: string]: any (#3566)

* Change all [key:string]:any -> unknown

Skipping slate-hyperscript, since it seems to be an appropriate use of key: any

* Minor typo fix docs/api/locations

* Check/assert unknown attributes when needed
This commit is contained in:
Tim Buckley
2020-05-04 17:16:03 -04:00
committed by GitHub
parent aacfde3bad
commit d8adf51add
17 changed files with 42 additions and 38 deletions

View File

@@ -708,7 +708,7 @@ export const Editable = (props: EditableProps) => {
if (Hotkeys.isRedo(nativeEvent)) {
event.preventDefault()
if (editor.redo) {
if (typeof editor.redo === 'function') {
editor.redo()
}
@@ -718,7 +718,7 @@ export const Editable = (props: EditableProps) => {
if (Hotkeys.isUndo(nativeEvent)) {
event.preventDefault()
if (editor.undo) {
if (typeof editor.undo === 'function') {
editor.undo()
}

View File

@@ -43,7 +43,7 @@ const Leaf = (props: {
opacity: '0.333',
}}
>
{leaf.placeholder}
{leaf.placeholder as React.ReactNode}
</span>
{children}
</React.Fragment>

View File

@@ -17,7 +17,7 @@ export const Slate = (props: {
value: Node[]
children: React.ReactNode
onChange: (value: Node[]) => void
[key: string]: any
[key: string]: unknown
}) => {
const { editor, children, onChange, value, ...rest } = props
const [key, setKey] = useState(0)