Skip to content

Commit 37913d5

Browse files
authored
fix: update getPos type inside NodeViewRendererProps(#5623)
1 parent 14afcad commit 37913d5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/green-wolves-arrive.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@tiptap/core": major
3+
---
4+
5+
Fix `getPos` type in `NodeViewRendererProps` to potentially be `undefined`
6+
7+
Breaking change: Types may flag uses of getPos where an `undefined` possibility isn't handled.
8+
Why this change was made: To ensure the type reflects the real functionality of this function.
9+
How to update: Ensure that the return value of `getPos` exists before making use of the value.

packages/core/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export type NodeViewRendererProps = {
236236
// pass-through from prosemirror
237237
node: Parameters<NodeViewConstructor>[0];
238238
view: Parameters<NodeViewConstructor>[1];
239-
getPos: () => number; // TODO getPos was incorrectly typed before, change to `Parameters<NodeViewConstructor>[2];` in the next major version
239+
getPos: Parameters<NodeViewConstructor>[2];
240240
decorations: Parameters<NodeViewConstructor>[3];
241241
innerDecorations: Parameters<NodeViewConstructor>[4];
242242
// tiptap-specific

0 commit comments

Comments
 (0)