refactor: General improvements for TypeScript types #883
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
BREAKING CHANGE: Fix TypeScript types for the Suggestion plugin
command
function (allowing for generic override).Although this was not causing any issues for us due to the convoluted implementation, the same fix was recently applied to Tiptap, and this aligns our suggestion factory function implementation with the original one. Unfortunately, this comes as a breaking change (examples were also updated to reflect the required changes).
Additionally, other smaller TypeScript types were refactored for consistency and clarity, but these are safe changes.
PR Checklist
Test plan
Tip
"work as expected" in the context of mentions and hashtags means that the suggestions are shown correctly, they can be inserted into the editor without issues, the Markdown output is as before, the HTML (inspect the DOM) is as before, and the the
onMentionItemSelect
output in the "Actions" tab (at the bottom of the Storybook) is also as before. Feel free to compare the preview Storybook with the production one.Rich-text → Default
story@
#