fix: Remove more instances of AnyDuringMigration (#9562)

* fix: Remove more instances of `AnyDuringMigration`

* chore: Fix lint
This commit is contained in:
Aaron Dodson
2026-01-12 11:23:18 -08:00
committed by GitHub
parent 25c6187d88
commit 9fc05dfe47
10 changed files with 17 additions and 61 deletions
+1 -1
View File
@@ -462,7 +462,7 @@ const PROCEDURE_DEF_COMMON = {
// Add option to create caller.
const name = this.getFieldValue('NAME');
const callProcedureBlockState = {
type: (this as AnyDuringMigration).callType_,
type: this.callType_,
extraState: {name: name, params: this.arguments_},
};
options.push({
-4
View File
@@ -208,10 +208,6 @@ export class Gesture {
browserEvents.unbind(event);
}
this.boundEvents.length = 0;
if (this.workspaceDragger) {
this.workspaceDragger.dispose();
}
}
/**
+1 -1
View File
@@ -172,7 +172,7 @@ export class Input {
// Note: Currently there are only unit tests for block.setCollapsed()
// because this function is package. If this function goes back to being a
// public API tests (lots of tests) should be added.
let renderList: AnyDuringMigration[] = [];
let renderList: BlockSvg[] = [];
if (this.visible === visible) {
return renderList;
}
+2 -3
View File
@@ -11,7 +11,6 @@
*/
// Former goog.module ID: Blockly.RenderedConnection
import type {Block} from './block.js';
import type {BlockSvg} from './block_svg.js';
import {config} from './config.js';
import {Connection} from './connection.js';
@@ -416,13 +415,13 @@ export class RenderedConnection
*
* @returns List of blocks to render.
*/
startTrackingAll(): Block[] {
startTrackingAll(): BlockSvg[] {
this.setTracking(true);
// All blocks that are not tracked must start tracking before any
// rendering takes place, since rendering requires knowing the dimensions
// of lower blocks. Also, since rendering a block renders all its parents,
// we only need to render the leaf nodes.
let renderList: Block[] = [];
let renderList: BlockSvg[] = [];
if (
this.type !== ConnectionType.INPUT_VALUE &&
this.type !== ConnectionType.NEXT_STATEMENT
+9 -35
View File
@@ -104,52 +104,26 @@ export function save(
if (block.isInsertionMarker()) {
return null;
}
const state = {
const state: State = {
'type': block.type,
'id': saveIds ? block.id : undefined,
};
if (addCoordinates) {
// AnyDuringMigration because: Argument of type '{ type: string; id:
// string; }' is not assignable to parameter of type 'State'.
saveCoords(block, state as AnyDuringMigration);
saveCoords(block, state);
}
// AnyDuringMigration because: Argument of type '{ type: string; id: string;
// }' is not assignable to parameter of type 'State'.
saveAttributes(block, state as AnyDuringMigration);
// AnyDuringMigration because: Argument of type '{ type: string; id: string;
// }' is not assignable to parameter of type 'State'.
saveExtraState(block, state as AnyDuringMigration, doFullSerialization);
// AnyDuringMigration because: Argument of type '{ type: string; id: string;
// }' is not assignable to parameter of type 'State'.
saveIcons(block, state as AnyDuringMigration, doFullSerialization);
// AnyDuringMigration because: Argument of type '{ type: string; id: string;
// }' is not assignable to parameter of type 'State'.
saveFields(block, state as AnyDuringMigration, doFullSerialization);
saveAttributes(block, state);
saveExtraState(block, state, doFullSerialization);
saveIcons(block, state, doFullSerialization);
saveFields(block, state, doFullSerialization);
if (addInputBlocks) {
// AnyDuringMigration because: Argument of type '{ type: string; id:
// string; }' is not assignable to parameter of type 'State'.
saveInputBlocks(
block,
state as AnyDuringMigration,
doFullSerialization,
saveIds,
);
saveInputBlocks(block, state, doFullSerialization, saveIds);
}
if (addNextBlocks) {
// AnyDuringMigration because: Argument of type '{ type: string; id:
// string; }' is not assignable to parameter of type 'State'.
saveNextBlocks(
block,
state as AnyDuringMigration,
doFullSerialization,
saveIds,
);
saveNextBlocks(block, state, doFullSerialization, saveIds);
}
// AnyDuringMigration because: Type '{ type: string; id: string; }' is not
// assignable to type 'State'.
return state as AnyDuringMigration;
return state;
}
/**
+1 -1
View File
@@ -110,7 +110,7 @@ export class WorkspaceCommentSerializer implements ISerializer {
save(workspace: Workspace): State[] | null {
const commentStates = [];
for (const comment of workspace.getTopComments()) {
const state = saveComment(comment as AnyDuringMigration, {
const state = saveComment(comment, {
addCoordinates: true,
saveIds: true,
});
+1 -1
View File
@@ -49,7 +49,7 @@ export const TOUCH_MAP: {[key: string]: string[]} = {
};
/** PID of queued long-press task. */
let longPid_: AnyDuringMigration = 0;
let longPid_: ReturnType<typeof setTimeout> = 0;
/**
* Context menus on touch devices are activated using a long-press.
-11
View File
@@ -39,17 +39,6 @@ export class WorkspaceDragger {
this.startScrollXY_ = new Coordinate(workspace.scrollX, workspace.scrollY);
}
/**
* Sever all links from this object.
*
* @internal
*/
dispose() {
// AnyDuringMigration because: Type 'null' is not assignable to type
// 'WorkspaceSvg'.
this.workspace = null as AnyDuringMigration;
}
/**
* Start dragging the workspace.
*
+1 -3
View File
@@ -47,9 +47,7 @@ export function workspaceToDom(workspace: Workspace, skipId = false): Element {
treeXml.appendChild(variablesElement);
}
for (const comment of workspace.getTopComments()) {
treeXml.appendChild(
saveWorkspaceComment(comment as AnyDuringMigration, skipId),
);
treeXml.appendChild(saveWorkspaceComment(comment, skipId));
}
const blocks = workspace.getTopBlocks(true);
for (let i = 0; i < blocks.length; i++) {
+1 -1
View File
@@ -232,7 +232,7 @@ export class DartGenerator extends CodeGenerator {
let comment = block.getCommentText();
if (comment) {
comment = stringUtils.wrap(comment, this.COMMENT_WRAP - 3);
if ((block as AnyDuringMigration).getProcedureDef) {
if ('getProcedureDef' in block) {
// Use documentation comment for function comments.
commentCode += this.prefixLines(comment + '\n', '/// ');
} else {