-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Update getPos
type inside NodeViewRendererProps
to reflect actual functionality
#5623
Update getPos
type inside NodeViewRendererProps
to reflect actual functionality
#5623
Conversation
🦋 Changeset detectedLatest commit: 8614cbb The changes in this PR will be included in the next version bump. This PR includes changesets to release 54 packages
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 |
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
As mentioned in the comment, this has to go towards a new major version so this PR is going to sit for a while |
Yep sounds good :) Just wanted to make sure it wasn't left behind when that time comes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll merge this into next
branch
Changes Overview
The type for
getPos
inside ofNodeViewRendererProps
was incorrectly typed to indicate that it always returns a number, when this is not the actual case. It can also returnundefined
.As per the ProseMirror documentation:
Trusting this function to always return a number has lead to some stability issues in our application, so I believe it's best that the type reflects the actual functionality, even if this may cause some headaches to handle
undefined
cases.Implementation Approach
Update the type to point towards
Parameters<NodeViewConstructor>[2]
, which I believe inherits offpm/view
.Testing Done
Verification Steps
getPos
inside of aNodeView
.Additional Notes
I'd consider this a breaking change, as it could flare up people's type checks if they're not handling the possibility of the return value being
undefined
, so I have marked it as needing a major version bump in the changeset.Checklist
Related Issues
#3823