1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-07 07:46:32 +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

@@ -5,7 +5,7 @@ Slate works with pure JSON objects. All it requires is that those JSON objects c
```ts
interface Text {
text: string
[key: string]: any
[key: string]: unknown
}
```
@@ -22,7 +22,7 @@ To take another example, the `Element` node interface in Slate is:
```ts
interface Element {
children: Node[]
[key: string]: any
[key: string]: unknown
}
```

View File

@@ -55,7 +55,7 @@ Elements make up the middle layers of a richtext document. They are the nodes th
```ts
interface Element {
children: Node[]
[key: string]: any
[key: string]: unknown
}
```
@@ -126,7 +126,7 @@ Text nodes are the lowest-level nodes in the tree, containing the text content o
```ts
interface Text {
text: string
[key: string]: any
[key: string]: unknown
}
```

View File

@@ -37,7 +37,7 @@ Points are slightly more specific than paths, and contain an `offset` into a spe
interface Point {
path: Path
offset: number
[key: string]: any
[key: string]: unknown
}
```
@@ -71,7 +71,7 @@ Ranges are a way to refer not just to a single point in the document, but to a w
interface Range {
anchor: Point
focus: Point
[key: string]: any
[key: string]: unknown
}
```

View File

@@ -8,7 +8,7 @@ interface Editor {
selection: Range | null
operations: Operation[]
marks: Record<string, any> | null
[key: string]: any
[key: string]: unknown
// Schema-specific node behaviors.
isInline: (element: Element) => boolean