fix: update getPos type inside NodeViewRendererProps(#5623)

This commit is contained in:
William Park 2024-09-24 21:40:46 +01:00 committed by GitHub
parent 14afcadd7b
commit 37913d5633
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,9 @@
---
"@tiptap/core": major
---
Fix `getPos` type in `NodeViewRendererProps` to potentially be `undefined`
Breaking change: Types may flag uses of getPos where an `undefined` possibility isn't handled.
Why this change was made: To ensure the type reflects the real functionality of this function.
How to update: Ensure that the return value of `getPos` exists before making use of the value.

View File

@ -236,7 +236,7 @@ export type NodeViewRendererProps = {
// pass-through from prosemirror
node: Parameters<NodeViewConstructor>[0];
view: Parameters<NodeViewConstructor>[1];
getPos: () => number; // TODO getPos was incorrectly typed before, change to `Parameters<NodeViewConstructor>[2];` in the next major version
getPos: Parameters<NodeViewConstructor>[2];
decorations: Parameters<NodeViewConstructor>[3];
innerDecorations: Parameters<NodeViewConstructor>[4];
// tiptap-specific