diff --git a/js/CCKCUtils.ts b/js/CCKCUtils.ts index 3bfd728f..188e28ea 100644 --- a/js/CCKCUtils.ts +++ b/js/CCKCUtils.ts @@ -41,7 +41,7 @@ const CCKCUtils = { * @returns {string} * @public */ - createCurrentReadout: function( current: number, blackBoxStudy: boolean ): string { + createCurrentReadout: function( current: number | null, blackBoxStudy: boolean ): string { if ( CCKCQueryParameters.fullPrecisionAmmeter ) { return current + ''; } diff --git a/js/view/AmmeterNode.ts b/js/view/AmmeterNode.ts index 24bc1bbd..8e7abbd3 100644 --- a/js/view/AmmeterNode.ts +++ b/js/view/AmmeterNode.ts @@ -93,7 +93,7 @@ class AmmeterNode extends Node { ); const currentReadoutProperty = new DerivedProperty( [ ammeter.currentProperty, ammeterReadoutTypeProperty ], - ( ( current: number, ammeterReadoutType: AmmeterReadoutType ) => { + ( ( current: number | null, ammeterReadoutType: AmmeterReadoutType ) => { return CCKCUtils.createCurrentReadout( current, options.blackBoxStudy ); } ) ); diff --git a/js/view/CCKCChartNode.ts b/js/view/CCKCChartNode.ts index 7c44f668..227120fa 100644 --- a/js/view/CCKCChartNode.ts +++ b/js/view/CCKCChartNode.ts @@ -38,6 +38,7 @@ import CircuitLayerNode from './CircuitLayerNode.js'; import Property from '../../../axon/js/Property.js'; import Bounds2 from '../../../dot/js/Bounds2.js'; import CCKCScreenView from './CCKCScreenView.js'; +import IReadOnlyProperty from '../../../axon/js/IReadOnlyProperty.js'; const oneSecondString = circuitConstructionKitCommonStrings.oneSecond; const timeString = circuitConstructionKitCommonStrings.time; @@ -66,8 +67,8 @@ class CCKCChartNode extends Node { private backgroundDragListener: DragListener | null; private readonly alignProbesEmitter: Emitter<[]>; private readonly droppedEmitter: Emitter<[]>; - protected readonly aboveBottomLeft1: DerivedProperty; - protected readonly aboveBottomLeft2: DerivedProperty; + protected readonly aboveBottomLeft1: IReadOnlyProperty; + protected readonly aboveBottomLeft2: IReadOnlyProperty; private readonly zoomLevelProperty: Property; protected readonly updatePen: () => void; @@ -374,7 +375,7 @@ class CCKCChartNode extends Node { * @returns {CCKCProbeNode} * @protected */ - addProbeNode( color: string, wireColor: string, dx: number, dy: number, connectionProperty: Property, tandem: Tandem ) { + addProbeNode( color: string, wireColor: string, dx: number, dy: number, connectionProperty: IReadOnlyProperty, tandem: Tandem ) { const probeNode = new CCKCProbeNode( this, this.visibleBoundsProperty, { color: color, tandem: tandem } ); // Add the wire behind the probe. diff --git a/js/view/FixedCircuitElementNode.ts b/js/view/FixedCircuitElementNode.ts index d83355e2..feb4391d 100644 --- a/js/view/FixedCircuitElementNode.ts +++ b/js/view/FixedCircuitElementNode.ts @@ -65,7 +65,7 @@ class FixedCircuitElementNode extends CircuitElementNode { private readonly dragListener: CircuitLayerNodeDragListener | null; static webglSpriteNodes: Node[]; private readonly updateHighlightVisibility: ( ( circuitElement: CircuitElement | null ) => void ) | null; - private readonly updateFireMultilink: Multilink | null; + private readonly updateFireMultilink: Multilink<[ number, number, boolean ]> | null; /** * @param {CCKCScreenView|null} screenView - the main screen view, null for isIcon @@ -214,7 +214,7 @@ class FixedCircuitElementNode extends CircuitElementNode { if ( screenView ) { // @private {Multilink} - Show fire in batteries and resistors with resistance > 0 - this.updateFireMultilink = Property.multilink( [ + this.updateFireMultilink = Property.multilink<[ number, number, boolean ]>( [ circuitElement.currentProperty, ( circuitElement instanceof Resistor ) ? circuitElement.resistanceProperty : ONE_AMP_PROPERTY, screenView.model.isValueDepictionEnabledProperty diff --git a/js/view/VoltmeterNode.ts b/js/view/VoltmeterNode.ts index 3e43c3c5..2574e506 100644 --- a/js/view/VoltmeterNode.ts +++ b/js/view/VoltmeterNode.ts @@ -111,7 +111,7 @@ class VoltmeterNode extends Node { } ); // Displays the voltage reading - const voltageReadoutProperty = new DerivedProperty( [ voltmeter.voltageProperty ], ( voltage: number ) => + const voltageReadoutProperty = new DerivedProperty( [ voltmeter.voltageProperty ], ( voltage: number | null ) => voltage === null ? MathSymbols.NO_VALUE : CCKCUtils.createVoltageReadout( voltage ) );