diff --git a/js/accessibility/voicing/ReadingBlock.ts b/js/accessibility/voicing/ReadingBlock.ts index a076dcd8d..8398a6a41 100644 --- a/js/accessibility/voicing/ReadingBlock.ts +++ b/js/accessibility/voicing/ReadingBlock.ts @@ -368,7 +368,7 @@ const ReadingBlock = ( Type: SuperType, optionsAr const displays = ( this as unknown as Node ).getConnectedDisplays(); - const readingBlockUtterance = this.voicingUtterance as ReadingBlockUtterance; + const readingBlockUtterance = this.voicingUtterance; const content = this.collectResponse( { nameResponse: this.getReadingBlockNameResponse(), diff --git a/js/display/Display.ts b/js/display/Display.ts index 39ee325c0..047e95280 100644 --- a/js/display/Display.ts +++ b/js/display/Display.ts @@ -1166,7 +1166,7 @@ export default class Display { this._pointerOverlay = null; } else { - this._pointerOverlay = new PointerOverlay( this, this._rootNode! ); + this._pointerOverlay = new PointerOverlay( this, this._rootNode ); this.addOverlay( this._pointerOverlay ); } } @@ -1187,7 +1187,7 @@ export default class Display { this._pointerAreaOverlay = null; } else { - this._pointerAreaOverlay = new PointerAreaOverlay( this, this._rootNode! ); + this._pointerAreaOverlay = new PointerAreaOverlay( this, this._rootNode ); this.addOverlay( this._pointerAreaOverlay ); } } @@ -1208,8 +1208,8 @@ export default class Display { this._hitAreaOverlay = null; } else { - this._hitAreaOverlay = new HitAreaOverlay( this, this._rootNode! ); - this.addOverlay( this._hitAreaOverlay! ); + this._hitAreaOverlay = new HitAreaOverlay( this, this._rootNode ); + this.addOverlay( this._hitAreaOverlay ); } } } @@ -1229,7 +1229,7 @@ export default class Display { this._canvasAreaBoundsOverlay = null; } else { - this._canvasAreaBoundsOverlay = new CanvasNodeBoundsOverlay( this, this._rootNode! ); + this._canvasAreaBoundsOverlay = new CanvasNodeBoundsOverlay( this, this._rootNode ); this.addOverlay( this._canvasAreaBoundsOverlay ); } } @@ -1250,7 +1250,7 @@ export default class Display { this._fittedBlockBoundsOverlay = null; } else { - this._fittedBlockBoundsOverlay = new FittedBlockBoundsOverlay( this, this._rootNode! ); + this._fittedBlockBoundsOverlay = new FittedBlockBoundsOverlay( this, this._rootNode ); this.addOverlay( this._fittedBlockBoundsOverlay ); } } @@ -1484,7 +1484,7 @@ export default class Display { } // @ts-ignore TODO BackboneDrawable - result += this._rootBackbone ? ( `Drawables: ${drawableCount( this._rootBackbone! )}
` ) : ''; + result += this._rootBackbone ? ( `Drawables: ${drawableCount( this._rootBackbone )}
` ) : ''; const drawableCountMap: Record = {}; // {string} drawable constructor name => {number} count of seen // increment the count in our map @@ -1752,7 +1752,7 @@ export default class Display { if ( this._rootBackbone ) { result += '
Root Drawable Tree
'; // @ts-ignore TODO BackboneDrawable - printDrawableSubtree( this._rootBackbone! ); + printDrawableSubtree( this._rootBackbone ); } //OHTWO TODO: add shared cache drawable trees diff --git a/js/input/BatchedDOMEvent.ts b/js/input/BatchedDOMEvent.ts index 83e2902da..e1e19e1da 100644 --- a/js/input/BatchedDOMEvent.ts +++ b/js/input/BatchedDOMEvent.ts @@ -70,7 +70,7 @@ export default class BatchedDOMEvent implements IPoolable { // according to spec (http://www.w3.org/TR/touch-events/), this is not an Array, but a TouchList const touch = touchEvent.changedTouches.item( i )!; - callback.call( input, touch!.identifier, input.pointFromEvent( touch ), touchEvent ); + callback.call( input, touch.identifier, input.pointFromEvent( touch ), touchEvent ); } } else if ( this.type === BatchedDOMEventType.MOUSE_TYPE ) { diff --git a/js/layout/LayoutAlign.ts b/js/layout/LayoutAlign.ts index 0e11a8a3c..99456abfa 100644 --- a/js/layout/LayoutAlign.ts +++ b/js/layout/LayoutAlign.ts @@ -63,9 +63,9 @@ export default class LayoutAlign extends EnumerationValue { return null; } - assert && assert( horizontalAlignMap[ key as 'left' | 'right' | 'center' | 'origin' ] ); + assert && assert( horizontalAlignMap[ key ] ); - return horizontalAlignMap[ key as 'left' | 'right' | 'center' | 'origin' ]; + return horizontalAlignMap[ key ]; } static verticalAlignToInternal( key: VerticalLayoutAlign | null ): LayoutAlign | null { @@ -73,9 +73,9 @@ export default class LayoutAlign extends EnumerationValue { return null; } - assert && assert( verticalAlignMap[ key as 'top' | 'bottom' | 'center' | 'origin' ] ); + assert && assert( verticalAlignMap[ key ] ); - return verticalAlignMap[ key as 'top' | 'bottom' | 'center' | 'origin' ]; + return verticalAlignMap[ key ]; } // Converts an internal Enumeration value into a string union value. diff --git a/js/layout/constraints/FlowConstraint.ts b/js/layout/constraints/FlowConstraint.ts index b2aa997de..76a0f8a17 100644 --- a/js/layout/constraints/FlowConstraint.ts +++ b/js/layout/constraints/FlowConstraint.ts @@ -258,7 +258,7 @@ export default class FlowConstraint extends FlowConfigurable( NodeLayoutConstrai assert && assert( amountToGrow > 1e-11 ); growableCells.forEach( cell => { - cell.size += amountToGrow * cell.effectiveGrow!; + cell.size += amountToGrow * cell.effectiveGrow; } ); spaceRemaining -= amountToGrow * totalGrow; } diff --git a/js/listeners/DragListener.ts b/js/listeners/DragListener.ts index a77be7eb7..09ae6899b 100644 --- a/js/listeners/DragListener.ts +++ b/js/listeners/DragListener.ts @@ -347,7 +347,7 @@ export default class DragListener extends PressListener implements IInputListene this.attachTransformTracker(); assert && assert( pressedListener.pointer.point !== null ); - const point = pressedListener.pointer.point!; + const point = pressedListener.pointer.point; // Compute the parent point corresponding to the pointer's position const parentPoint = this.globalToParentPoint( this._localPoint.set( point ) ); diff --git a/js/listeners/FireListener.ts b/js/listeners/FireListener.ts index 2f88b6535..9a844900e 100644 --- a/js/listeners/FireListener.ts +++ b/js/listeners/FireListener.ts @@ -65,7 +65,7 @@ export default class FireListener extends PressListener implements IInputListene this._fireOnDown = options.fireOnDown; this.firedEmitter = new Emitter<[ SceneryEvent | null ]>( { - tandem: options.tandem!.createTandem( 'firedEmitter' ), + tandem: options.tandem.createTandem( 'firedEmitter' ), // @ts-ignore TODO EventType phetioEventType: EventType.USER, phetioReadOnly: options.phetioReadOnly, diff --git a/js/listeners/KeyboardDragListener.ts b/js/listeners/KeyboardDragListener.ts index b5c97628e..fb837324c 100644 --- a/js/listeners/KeyboardDragListener.ts +++ b/js/listeners/KeyboardDragListener.ts @@ -882,7 +882,7 @@ class KeyboardDragListener extends EnabledComponent implements IInputListener { if ( this._pointer ) { assert && assert( this._pointer.listeners.includes( this._pointerListener ), 'A reference to the Pointer means it should have the pointerListener' ); - this._pointer!.removeInputListener( this._pointerListener ); + this._pointer.removeInputListener( this._pointerListener ); this._pointer = null; } } diff --git a/js/nodes/Imageable.ts b/js/nodes/Imageable.ts index 2a013770e..8677e6949 100644 --- a/js/nodes/Imageable.ts +++ b/js/nodes/Imageable.ts @@ -257,7 +257,7 @@ const Imageable = ( type: SuperType ) => { } // We ruled out the string | Mipmap cases above - this._image = image as HTMLImageElement | HTMLCanvasElement; + this._image = image; // If our image is an HTML image that hasn't loaded yet, attach a load listener. if ( this._image instanceof HTMLImageElement && ( !this._image.width || !this._image.height ) ) { diff --git a/js/nodes/Node.ts b/js/nodes/Node.ts index 734e2899f..a4ee23b6b 100644 --- a/js/nodes/Node.ts +++ b/js/nodes/Node.ts @@ -2603,7 +2603,7 @@ class Node extends ParallelDOM { if ( typeof a === 'number' ) { assert && assert( typeof a === 'number' && isFinite( a ), 'Parameters to setTranslation should be finite numbers' ); assert && assert( typeof b === 'number' && isFinite( b ), 'Parameters to setTranslation should be finite numbers' ); - dx = a as number - tx; + dx = a - tx; dy = b as number - ty; } else { diff --git a/js/nodes/Text.ts b/js/nodes/Text.ts index 033cd1794..7f53e8bb0 100644 --- a/js/nodes/Text.ts +++ b/js/nodes/Text.ts @@ -167,7 +167,7 @@ export default class Text extends Paintable( Node ) { } } - return this._cachedRenderedText!; + return this._cachedRenderedText; } get renderedText(): string { return this.getRenderedText(); } diff --git a/js/overlays/PointerAreaOverlay.ts b/js/overlays/PointerAreaOverlay.ts index 6942596ac..8bea14169 100644 --- a/js/overlays/PointerAreaOverlay.ts +++ b/js/overlays/PointerAreaOverlay.ts @@ -26,10 +26,10 @@ export default class PointerAreaOverlay extends ShapeBasedOverlay implements IOv const transform = trail.getTransform(); if ( node.mouseArea ) { - this.addShape( transform.transformShape( node.mouseArea instanceof Bounds2 ? Shape.bounds( node.mouseArea as Bounds2 ) : node.mouseArea ), 'rgba(0,0,255,0.8)', true ); + this.addShape( transform.transformShape( node.mouseArea instanceof Bounds2 ? Shape.bounds( node.mouseArea ) : node.mouseArea ), 'rgba(0,0,255,0.8)', true ); } if ( node.touchArea ) { - this.addShape( transform.transformShape( node.touchArea instanceof Bounds2 ? Shape.bounds( node.touchArea as Bounds2 ) : node.touchArea ), 'rgba(255,0,0,0.8)', false ); + this.addShape( transform.transformShape( node.touchArea instanceof Bounds2 ? Shape.bounds( node.touchArea ) : node.touchArea ), 'rgba(255,0,0,0.8)', false ); } } return false; diff --git a/js/util/Font.ts b/js/util/Font.ts index c9d5de93e..3a54fe96e 100644 --- a/js/util/Font.ts +++ b/js/util/Font.ts @@ -291,7 +291,7 @@ export default class Font extends PhetioObject { size: this._size, lineHeight: this._lineHeight, family: this._family - }, options ) as FontOptions ); + }, options ) ); } /** diff --git a/js/util/Picker.ts b/js/util/Picker.ts index 12dfa25a3..5bc5e007e 100644 --- a/js/util/Picker.ts +++ b/js/util/Picker.ts @@ -416,7 +416,7 @@ export default class Picker { // do this before the transformation to the parent coordinate frame (the mouseArea is in the local coordinate frame) if ( pointerArea ) { // we accept either Bounds2, or a Shape (in which case, we take the Shape's bounds) - mutableBounds.includeBounds( pointerArea instanceof Bounds2 ? ( pointerArea as Bounds2 ) : ( pointerArea as unknown as Shape ).bounds ); + mutableBounds.includeBounds( pointerArea instanceof Bounds2 ? ( pointerArea ) : ( pointerArea as unknown as Shape ).bounds ); } const clipArea = this.node.clipArea; @@ -679,7 +679,7 @@ export default class Picker { node._picker.audit(); } ); - const localAssertSlow = assertSlow!; + const localAssertSlow = assertSlow; const expectedSelfPruned = this.node.pickable === false || !this.node.isVisible(); const expectedSelfInclusive = this.node.pickable === true || this.node._inputListeners.length > 0; diff --git a/js/util/ProfileColorProperty.ts b/js/util/ProfileColorProperty.ts index 7e8289125..7a44ac9e0 100644 --- a/js/util/ProfileColorProperty.ts +++ b/js/util/ProfileColorProperty.ts @@ -50,7 +50,7 @@ export default class ProfileColorProperty extends ColorProperty { useDeepEquality: true }, providedOptions ); - const tandem = options.tandem!; + const tandem = options.tandem; // All values are eagerly coerced to Color instances for efficiency (so it only has to be done once) and simplicity // (so the types are uniform) diff --git a/js/util/scenerySerialize.ts b/js/util/scenerySerialize.ts index 3386f552c..af7b01bec 100644 --- a/js/util/scenerySerialize.ts +++ b/js/util/scenerySerialize.ts @@ -19,8 +19,8 @@ const scenerySerialize = ( value: unknown ): any => { if ( value instanceof Vector2 ) { return { type: 'Vector2', - x: ( value as Vector2 ).x, - y: ( value as Vector2 ).y + x: ( value ).x, + y: ( value ).y }; } else if ( value instanceof Matrix3 ) { @@ -38,7 +38,7 @@ const scenerySerialize = ( value: unknown ): any => { }; } else if ( value instanceof Bounds2 ) { - const bounds = value as Bounds2; + const bounds = value; return { type: 'Bounds2', maxX: bounds.maxX,