Skip to content

Commit 020dab5

Browse files
authored
fix: Fix build errors from removed cast to any (#512)
1 parent d1ff7b0 commit 020dab5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/actions/insert.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,12 @@ export class InsertAction {
8888
return this.insertPrecondition(ws) ? 'enabled' : 'hidden';
8989
},
9090
callback: (scope: ContextMenuRegistry.Scope) => {
91-
const ws =
92-
scope.focusedNode?.workspace ??
93-
(scope.focusedNode?.getSourceBlock().workspace as WorkspaceSvg);
91+
let ws;
92+
if (scope.focusedNode instanceof Blockly.Block) {
93+
ws = scope.focusedNode.workspace as WorkspaceSvg;
94+
} else if (scope.focusedNode instanceof Blockly.Connection) {
95+
ws = scope.focusedNode.getSourceBlock()?.workspace as WorkspaceSvg;
96+
}
9497
if (!ws) return false;
9598
this.insertCallback(ws);
9699
},

0 commit comments

Comments
 (0)