Skip to content

Commit

Permalink
refactor(react): flip order of useEditorState overloads
Browse files Browse the repository at this point in the history
So that TypeScript will resolve the non-nullable one first, unless the editor is nullable, in which case the other one will resolve.
  • Loading branch information
alii committed Jul 11, 2024
1 parent 91d8f58 commit e902c12
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/react/src/useEditorState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ function makeEditorStateInstance<TEditor extends Editor | null = Editor | null>(
return editorInstance
}

export function useEditorState<TSelectorResult>(
options: UseEditorStateOptions<TSelectorResult, Editor | null>
): TSelectorResult | null;
export function useEditorState<TSelectorResult>(
options: UseEditorStateOptions<TSelectorResult, Editor>
): TSelectorResult;
export function useEditorState<TSelectorResult>(
options: UseEditorStateOptions<TSelectorResult, Editor | null>
): TSelectorResult | null;

export function useEditorState<TSelectorResult>(
options: UseEditorStateOptions<TSelectorResult, Editor> | UseEditorStateOptions<TSelectorResult, Editor | null>,
Expand Down

0 comments on commit e902c12

Please sign in to comment.