mirror of
https://github.com/google/blockly.git
synced 2026-06-17 08:35:12 +02:00
fix: Remove more instances of AnyDuringMigration (#9562)
* fix: Remove more instances of `AnyDuringMigration` * chore: Fix lint
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -208,10 +208,6 @@ export class Gesture {
|
||||
browserEvents.unbind(event);
|
||||
}
|
||||
this.boundEvents.length = 0;
|
||||
|
||||
if (this.workspaceDragger) {
|
||||
this.workspaceDragger.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
@@ -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.
|
||||
|
||||
@@ -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
@@ -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++) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user