Skip to content

Commit 15a42c9

Browse files
fix: mark clearHistory as optional in MindElixirInstance
clearHistory is only registered by the operationHistory plugin, which is skipped when allowUndo is false. Declaring it as a required method would be a type-runtime mismatch. Mark it optional and update the JSDoc to mention the allowUndo prerequisite.
1 parent 601dc4b commit 15a42c9

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/types/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ export interface MindElixirInstance extends Omit<Required<Options>, 'markdown' |
126126
* current diagram state. Call this after loading new data into an existing
127127
* instance (e.g. after `refresh()`) to prevent users from undoing back into
128128
* a previously loaded diagram.
129+
*
130+
* Only available when `allowUndo` is `true` (the default).
129131
*/
130-
clearHistory: () => void
132+
clearHistory?: () => void
131133

132134
selection: SelectionArea
133135
dragMoveHelper: ReturnType<typeof createDragMoveHelper>

0 commit comments

Comments
 (0)