Skip to content

Commit ff81abb

Browse files
committed
fix(template-builder): cast command returns to boolean for TS build
After the types barrel conversion, EditorCommands resolves command return types as unknown/{} instead of boolean, breaking strict tsc.
1 parent b5ef21b commit ff81abb

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

packages/template-builder/src/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ const SuperDocTemplateBuilder = forwardRef<Types.SuperDocTemplateBuilderHandle,
139139
})
140140
: undefined;
141141

142-
const success =
142+
const success = (
143143
mode === 'inline'
144144
? editor.commands.insertStructuredContentInline?.({
145145
attrs: {
@@ -154,7 +154,8 @@ const SuperDocTemplateBuilder = forwardRef<Types.SuperDocTemplateBuilderHandle,
154154
tag: tagData,
155155
},
156156
text: field.defaultValue || field.alias,
157-
});
157+
})
158+
) as boolean | undefined;
158159

159160
if (success) {
160161
const updatedFields = getTemplateFieldsFromEditor(editor);
@@ -183,7 +184,7 @@ const SuperDocTemplateBuilder = forwardRef<Types.SuperDocTemplateBuilderHandle,
183184
const editor = superdocRef.current.activeEditor;
184185
const success = editor.commands.updateStructuredContentById?.(id, {
185186
attrs: updates,
186-
});
187+
}) as boolean | undefined;
187188

188189
if (success) {
189190
setTemplateFields((prev) => {
@@ -228,7 +229,7 @@ const SuperDocTemplateBuilder = forwardRef<Types.SuperDocTemplateBuilderHandle,
228229

229230
let commandResult = false;
230231
try {
231-
commandResult = editor.commands.deleteStructuredContentById?.(id) ?? false;
232+
commandResult = (editor.commands.deleteStructuredContentById?.(id) as boolean | undefined) ?? false;
232233
} catch (err) {
233234
console.warn('[TemplateBuilder] Failed to delete structured content:', id, err);
234235
commandResult = false;

0 commit comments

Comments
 (0)