From 8b9819bb05a09582e1ca85a3bbbf8e7e21f147ac Mon Sep 17 00:00:00 2001 From: Nick the Sick Date: Sat, 1 Jun 2024 18:26:32 +0200 Subject: [PATCH] chore: better typing --- packages/react/src/useEditor.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react/src/useEditor.ts b/packages/react/src/useEditor.ts index 865925f4d68..944501d5511 100644 --- a/packages/react/src/useEditor.ts +++ b/packages/react/src/useEditor.ts @@ -87,8 +87,8 @@ function makeEditorInstance({ /** * Always disable the editor on the server-side. */ - getServerSnapshot() { - return null + getServerSnapshot(): [null, null] { + return [null, null] }, /** * Subscribe to the editor instance's changes. @@ -200,7 +200,7 @@ function useEditor(options: UseEditorOptions = }) // Using the `useSyncExternalStore` hook to sync the editor instance with the component state - const editor = useSyncExternalStore(editorInstance.subscribe, editorInstance.getSnapshot, editorInstance.getServerSnapshot)?.[0] || null + const [editor] = useSyncExternalStore(editorInstance.subscribe, editorInstance.getSnapshot, editorInstance.getServerSnapshot) useDebugValue(editor)