Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion blocks/procedures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
4 changes: 0 additions & 4 deletions core/gesture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,6 @@ export class Gesture {
browserEvents.unbind(event);
}
this.boundEvents.length = 0;

if (this.workspaceDragger) {
this.workspaceDragger.dispose();
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion core/inputs/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
5 changes: 2 additions & 3 deletions core/rendered_connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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
Expand Down
46 changes: 10 additions & 36 deletions core/serialization/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
// 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);
saveCoords(block, state);
}
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;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion core/serialization/workspace_comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
2 changes: 1 addition & 1 deletion core/touch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 0 additions & 11 deletions core/workspace_dragger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
4 changes: 1 addition & 3 deletions core/xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
2 changes: 1 addition & 1 deletion generators/dart/dart_generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading