Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use extended Editor type in useSlateWithV return type #5763

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

TyMick
Copy link
Contributor

@TyMick TyMick commented Nov 8, 2024

Description

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. This change brings useSlateWithV's return type in line with those of useSlate and useSlateStatic.

Checks

  • The new code matches the existing patterns and styles.
  • The tests pass with yarn test.
  • The linter passes with yarn lint. (Fix errors with yarn fix.)
  • You've added a changeset if changing functionality. (Add one with yarn changeset add.)

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.
Copy link

changeset-bot bot commented Nov 8, 2024

🦋 Changeset detected

Latest commit: 214e939

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
slate-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@TyMick
Copy link
Contributor Author

TyMick commented Nov 8, 2024

Should we add a release note that this may be a breaking type change if someone isn't defining a custom Editor type that includes ReactEditor? Probably an uncommon situation, since anyone who hasn't extended Editor with ReactEditor would already have problems with useSlate and useSlateStatic.

@dylans
Copy link
Collaborator

dylans commented Nov 19, 2024

Should we add a release note that this may be a breaking type change if someone isn't defining a custom Editor type that includes ReactEditor? Probably an uncommon situation, since anyone who hasn't extended Editor with ReactEditor would already have problems with useSlate and useSlateStatic.

We could, though I think the description is probably sufficient already, so I'm going to land it.

@dylans dylans merged commit 644ebdc into ianstormtaylor:main Nov 19, 2024
11 checks passed
@github-actions github-actions bot mentioned this pull request Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants