mirror of
https://github.com/google/blockly.git
synced 2026-01-07 00:50:27 +01:00
fix: some AnyDuringMigration (#6430)
* fix: remove some AnyDuringMigrations * fix: some instances of AnyDuringMigration * fix: some AnyDuringMigration * chore: revert comment removal
This commit is contained in:
@@ -580,13 +580,11 @@ export class Block implements IASTNodeLocation, IDeletable {
|
||||
*/
|
||||
getSurroundParent(): this|null {
|
||||
/* eslint-disable-next-line @typescript-eslint/no-this-alias */
|
||||
let block = this;
|
||||
let block: this|null = this;
|
||||
let prevBlock;
|
||||
do {
|
||||
prevBlock = block;
|
||||
// AnyDuringMigration because: Type 'Block | null' is not assignable to
|
||||
// type 'this'.
|
||||
block = block.getParent() as AnyDuringMigration;
|
||||
block = block.getParent();
|
||||
if (!block) {
|
||||
// Ran off the top.
|
||||
return null;
|
||||
|
||||
@@ -333,9 +333,7 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg,
|
||||
}
|
||||
|
||||
dom.startTextWidthCache();
|
||||
// AnyDuringMigration because: Argument of type 'Block | null' is not
|
||||
// assignable to parameter of type 'Block'.
|
||||
super.setParent(newParent as AnyDuringMigration);
|
||||
super.setParent(newParent);
|
||||
dom.stopTextWidthCache();
|
||||
|
||||
const svgRoot = this.getSvgRoot();
|
||||
@@ -642,10 +640,7 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg,
|
||||
}
|
||||
const input = this.getInput(collapsedInputName) ||
|
||||
this.appendDummyInput(collapsedInputName);
|
||||
// AnyDuringMigration because: Argument of type 'FieldLabel' is not
|
||||
// assignable to parameter of type 'string | Field'.
|
||||
input.appendField(
|
||||
new FieldLabel(text) as AnyDuringMigration, collapsedFieldName);
|
||||
input.appendField(new FieldLabel(text), collapsedFieldName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -737,9 +732,7 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg,
|
||||
|
||||
if (menuOptions && menuOptions.length) {
|
||||
ContextMenu.show(e, menuOptions, this.RTL);
|
||||
// AnyDuringMigration because: Argument of type 'this' is not assignable
|
||||
// to parameter of type 'Block | null'.
|
||||
ContextMenu.setCurrentBlock(this as AnyDuringMigration);
|
||||
ContextMenu.setCurrentBlock(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -958,16 +951,12 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg,
|
||||
if (this.isInsertionMarker_) {
|
||||
return null;
|
||||
}
|
||||
// AnyDuringMigration because: Argument of type 'this' is not assignable to
|
||||
// parameter of type 'Block'. AnyDuringMigration because: Argument of type
|
||||
// 'this' is not assignable to parameter of type 'Block'.
|
||||
return {
|
||||
saveInfo: blocks.save(
|
||||
this as AnyDuringMigration,
|
||||
{addCoordinates: true, addNextBlocks: false}) as
|
||||
saveInfo:
|
||||
blocks.save(this, {addCoordinates: true, addNextBlocks: false}) as
|
||||
blocks.State,
|
||||
source: this.workspace,
|
||||
typeCounts: common.getBlockTypeCounts(this as AnyDuringMigration, true),
|
||||
typeCounts: common.getBlockTypeCounts(this, true),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1278,7 +1267,7 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg,
|
||||
*/
|
||||
bringToFront() {
|
||||
/* eslint-disable-next-line @typescript-eslint/no-this-alias */
|
||||
let block = this;
|
||||
let block: this|null = this;
|
||||
do {
|
||||
const root = block.getSvgRoot();
|
||||
const parent = root.parentNode;
|
||||
@@ -1287,9 +1276,7 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg,
|
||||
if (childNodes[childNodes.length - 1] !== root) {
|
||||
parent!.appendChild(root);
|
||||
}
|
||||
// AnyDuringMigration because: Type 'BlockSvg | null' is not assignable
|
||||
// to type 'this'.
|
||||
block = block.getParent() as AnyDuringMigration;
|
||||
block = block.getParent();
|
||||
} while (block);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user