Skip to content

Commit

Permalink
NumberProperty.range and rangeProperty cannot be of type null, phetsi…
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Dec 3, 2022
1 parent f8bdef5 commit 16f22a7
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion js/common/model/CountingPlayArea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ class CountingPlayArea extends CountingCommonModel {
const objectMargin = 3;

const numberOfColumns = 5; // rows
const numberOfRows = this.sumProperty.range!.max / numberOfColumns;
const numberOfRows = this.sumProperty.range.max / numberOfColumns;

const xMargin = 88; // empirically determined to center group TODO: figure out why math isn't working for this
const yMargin = CountingCommonConstants.COUNTING_PLAY_AREA_MARGIN;
Expand Down
4 changes: 2 additions & 2 deletions js/common/view/CountingObjectCreatorPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ class CountingObjectCreatorPanel extends NumberPlayCreatorPanel {

// disable the arrow buttons when the currentNumberProperty value is at its min or max range
const currentNumberPropertyObserver = ( currentNumber: number ) => {
upArrowButton.enabled = currentNumber !== playArea.sumProperty.range!.max;
downArrowButton.enabled = currentNumber !== playArea.sumProperty.range!.min;
upArrowButton.enabled = currentNumber !== playArea.sumProperty.range.max;
downArrowButton.enabled = currentNumber !== playArea.sumProperty.range.min;
};
playArea.sumProperty.link( currentNumberPropertyObserver );
}
Expand Down
2 changes: 1 addition & 1 deletion js/common/view/NumberPlayPreferencesNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class NumberPlayPreferencesNode extends NumberSuiteCommonPreferen
// TODO: Make into its own type if we like this - make general number spinner control if we keep the compare max control
const subitizeTimeText = new Text( NumberPlayStrings.subitizeTimeStringProperty,
NumberSuiteCommonPreferencesNode.CONTROL_TEXT_BOLD_OPTIONS );
const subitizeTimeRange = numberPlayPreferences.subitizeTimeShownProperty.rangeProperty.value!;
const subitizeTimeRange = numberPlayPreferences.subitizeTimeShownProperty.rangeProperty.value;
const subitizeTimeSpinner = new NumberSpinner( numberPlayPreferences.subitizeTimeShownProperty,
new Property<Range>( subitizeTimeRange ), {
arrowsPosition: 'leftRight',
Expand Down
4 changes: 2 additions & 2 deletions js/common/view/TotalAccordionBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ class TotalAccordionBox extends NumberPlayAccordionBox {
// disable the arrow buttons when the currentNumberProperty value is at its min or max range
const currentNumberPropertyObserver = ( currentNumber: number ) => {
assert && assert( playArea.sumProperty.range, 'Range is required for sumProperty in play areas' );
upArrowButton.enabled = currentNumber !== playArea.sumProperty.range!.max;
downArrowButton.enabled = currentNumber !== playArea.sumProperty.range!.min;
upArrowButton.enabled = currentNumber !== playArea.sumProperty.range.max;
downArrowButton.enabled = currentNumber !== playArea.sumProperty.range.min;
};
playArea.sumProperty.link( currentNumberPropertyObserver );

Expand Down
2 changes: 1 addition & 1 deletion js/game/model/CountingGameLevel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CountingGameLevel extends NumberPlayGameLevel {
// whether grouping is enabled for a set of objects
this.groupObjectsEnabledProperty = new BooleanProperty( this.groupObjectsAllowed );

this.objectsPlayArea = new CountingPlayArea( this.challengeNumberProperty.range!.max, this.groupObjectsEnabledProperty, 'objectsPlayArea' );
this.objectsPlayArea = new CountingPlayArea( this.challengeNumberProperty.range.max, this.groupObjectsEnabledProperty, 'objectsPlayArea' );

// the object type of the current challenge
this.countingObjectTypeProperty = new EnumerationProperty( CountingGameLevel.getRandomCountingObjectType() );
Expand Down
2 changes: 1 addition & 1 deletion js/game/view/NumberPlayGameAnswerButtons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class NumberPlayGameAnswerButtons extends Node {
* Fires the button listener on the correct answer button.
*/
public showAnswer( challengeNumberProperty: NumberProperty ): void {
const buttonObjectIndex = challengeNumberProperty.value - challengeNumberProperty.range!.min;
const buttonObjectIndex = challengeNumberProperty.value - challengeNumberProperty.range.min;
this.buttonListener( buttonObjectIndex );
}

Expand Down

0 comments on commit 16f22a7

Please sign in to comment.