refactor: Remove more uses of AnyDuringMigration (#6863)

* refactor: Remove uses of AnyDuringMigration from xml.ts.

* refactor: Remove uses of AnyDuringMigration from block_svg.ts.

* refactor: Remove uses of AnyDuringMigration from theme_manager.ts.

* refactor: Remove uses of AnyDuringMigration from names.ts.

* refactor: Remove uses of AnyDuringMigration from field_angle.ts.

* refactor: Remove some uses of AnyDuringMigration from block.ts.

* refactor: Make safename construction more readable.

* fix: Use a default size for block comments.

* fix: Clarify test of shadow block disposal.

* fix: Update assert in workspace_svg_test to use isDeadOrDying().
This commit is contained in:
Aaron Dodson
2023-02-28 14:38:17 -08:00
committed by GitHub
parent c9e2af2a27
commit 8a44dff4e8
11 changed files with 98 additions and 202 deletions

View File

@@ -98,9 +98,7 @@ export class FieldAngle extends FieldInput<number> {
line_: SVGLineElement|null = null;
/** The degree symbol for this field. */
// AnyDuringMigration because: Type 'null' is not assignable to type
// 'SVGTSpanElement'.
protected symbol_: SVGTSpanElement = null as AnyDuringMigration;
protected symbol_: SVGTSpanElement|null = null;
/** Wrapper click event data. */
private clickWrapper_: browserEvents.Data|null = null;
@@ -213,10 +211,7 @@ export class FieldAngle extends FieldInput<number> {
this.sourceBlock_.style.colourTertiary);
}
// AnyDuringMigration because: Argument of type 'this' is not assignable to
// parameter of type 'Field'.
dropDownDiv.showPositionedByField(
this as AnyDuringMigration, this.dropdownDispose_.bind(this));
dropDownDiv.showPositionedByField(this, this.dropdownDispose_.bind(this));
this.updateGraph_();
}
@@ -387,12 +382,8 @@ export class FieldAngle extends FieldInput<number> {
' 0 ', largeFlag, ' ', clockwiseFlag, ' ', x2, ',', y2, ' z');
}
this.gauge_.setAttribute('d', path.join(''));
// AnyDuringMigration because: Argument of type 'number' is not assignable
// to parameter of type 'string'.
this.line_!.setAttribute('x2', x2 as AnyDuringMigration);
// AnyDuringMigration because: Argument of type 'number' is not assignable
// to parameter of type 'string'.
this.line_!.setAttribute('y2', y2 as AnyDuringMigration);
this.line_?.setAttribute('x2', `${x2}`);
this.line_?.setAttribute('y2', `${y2}`);
}
/**
@@ -435,8 +426,7 @@ export class FieldAngle extends FieldInput<number> {
* @param opt_newValue The input value.
* @returns A valid angle, or null if invalid.
*/
protected override doClassValidation_(opt_newValue?: AnyDuringMigration):
number|null {
protected override doClassValidation_(opt_newValue?: any): number|null {
const value = Number(opt_newValue);
if (isNaN(value) || !isFinite(value)) {
return null;