1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-19 05:31:56 +02:00

Use extended Editor type in useSlateWithV return type (#5763)

* Use extended `Editor` type in `useSlateWithV` return type

So it matches the return types of `useSlate` and `useSlateStatic`. The
`useSlateWithV` return object's `editor` property is currently typed as
just a `ReactEditor`, which causes type errors in our app when we try to
use it as the extended `Editor` type.

* Fix return types in "Editor hooks" docs
This commit is contained in:
Ty Mick
2024-11-19 10:14:47 -08:00
committed by GitHub
parent 49ba21a7ba
commit 644ebdc8f5
3 changed files with 9 additions and 4 deletions

View File

@@ -34,7 +34,7 @@ export const useSlate = (): Editor => {
return editor
}
export const useSlateWithV = () => {
export const useSlateWithV = (): { editor: Editor; v: number } => {
const context = useContext(SlateContext)
if (!context) {