Skip to content

Commit 1e4a5da

Browse files
committed
fix: correct return type of getDefaultReactSlashMenuItems to include key
The return type was missing the `key` property, causing type errors when accessing `item.key` on returned items.
1 parent 9b08341 commit 1e4a5da

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

packages/react/src/blocks/PageBreak/getPageBreakReactSlashMenuItems.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function getPageBreakReactSlashMenuItems<
1818
S extends StyleSchema,
1919
>(
2020
editor: BlockNoteEditor<BSchema, I, S>,
21-
): (Omit<DefaultReactSuggestionItem, "key"> & { key: "page_break" })[] {
21+
): (DefaultReactSuggestionItem & { key: "page_break" })[] {
2222
return getPageBreakSlashMenuItems(editor).map((item) => {
2323
const Icon = icons[item.key];
2424
return {

packages/react/src/components/SuggestionMenu/getDefaultReactSlashMenuItems.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
BlockNoteEditor,
33
BlockSchema,
4+
Dictionary,
45
InlineContentSchema,
56
StyleSchema,
67
} from "@blocknote/core";
@@ -61,7 +62,11 @@ export function getDefaultReactSlashMenuItems<
6162
BSchema extends BlockSchema,
6263
I extends InlineContentSchema,
6364
S extends StyleSchema,
64-
>(editor: BlockNoteEditor<BSchema, I, S>): DefaultReactSuggestionItem[] {
65+
>(
66+
editor: BlockNoteEditor<BSchema, I, S>,
67+
): (DefaultReactSuggestionItem & {
68+
key: keyof Omit<Dictionary["slash_menu"], "page_break">;
69+
})[] {
6570
return getDefaultSlashMenuItems(editor).map((item) => {
6671
const Icon = icons[item.key];
6772
return {

0 commit comments

Comments
 (0)