Skip to content

Commit

Permalink
required options can't have defaults in optionize defaults, phetsims/…
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Jan 9, 2023
1 parent dae5c1e commit 7167e37
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions js/model/Circuit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ export default class Circuit {
this.viewTypeProperty = viewTypeProperty;
this.addRealBulbsProperty = addRealBulbsProperty;

// @ts-expect-error TODO SR can you help with "blackBoxStudy" defined here, it is required https://github.com/phetsims/chipper/issues/1360
const options = optionize<CircuitOptions>()( { blackBoxStudy: false }, providedOptions );

this.includeACElements = options.includeACElements;
Expand Down
3 changes: 1 addition & 2 deletions js/view/CCKCChartNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ export default class CCKCChartNode extends Node {

// Prevent adjustment of the control panel rendering while dragging,
// see https://github.com/phetsims/wave-interference/issues/212
preventFit: true,
tandem: Tandem.OPTIONAL
preventFit: true
}, providedOptions ) as CCKCChartNodeOptions;
const backgroundNode = new Node( { cursor: 'pointer' } );

Expand Down
2 changes: 1 addition & 1 deletion js/view/CircuitElementToolFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ export default class CircuitElementToolFactory {

assert && assert( Number.isInteger( count ), 'count should be an integer' );

// TODO SR: please make sure that we PickRequired<ParentOptions, 'tandem'> here if applicable
const options = optionize<CreateCircuitElementToolNodeProvidedOptions, CreateCircuitElementToolNodeSelfOptions, CircuitElementToolNodeOptions>()( {
tandem: Tandem.REQUIRED,
additionalProperty: new BooleanProperty( true ),
lifelikeIconHeight: CCKCConstants.TOOLBOX_ICON_HEIGHT,
schematicIconHeight: CCKCConstants.TOOLBOX_ICON_HEIGHT
Expand Down
5 changes: 1 addition & 4 deletions js/view/CurrentChartNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import createObservableArray from '../../../axon/js/createObservableArray.js';
import Vector2 from '../../../dot/js/Vector2.js';
import Tandem from '../../../tandem/js/Tandem.js';
import CCKCConstants from '../CCKCConstants.js';
import CircuitConstructionKitCommonStrings from '../CircuitConstructionKitCommonStrings.js';
import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';
Expand All @@ -34,9 +33,7 @@ export default class CurrentChartNode extends CCKCChartNode {
public constructor( circuitLayerNode: CircuitLayerNode, timeProperty: Property<number>, visibleBoundsProperty: Property<Bounds2>,
providedOptions?: CCKCChartNodeOptions ) {

const options = optionize<CCKCChartNodeOptions, EmptySelfOptions, CCKCChartNodeOptions>()( {
tandem: Tandem.OPTIONAL
}, providedOptions );
const options = optionize<CCKCChartNodeOptions, EmptySelfOptions, CCKCChartNodeOptions>()( {}, providedOptions );

super( circuitLayerNode, timeProperty, visibleBoundsProperty, createObservableArray(), currentWithUnitsStringProperty, providedOptions );

Expand Down
8 changes: 4 additions & 4 deletions js/view/ZoomButtonGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ import { combineOptions } from '../../../phet-core/js/optionize.js';
import MagnifyingGlassZoomButtonGroup, { MagnifyingGlassZoomButtonGroupOptions } from '../../../scenery-phet/js/MagnifyingGlassZoomButtonGroup.js';
import PhetColorScheme from '../../../scenery-phet/js/PhetColorScheme.js';
import RectangularButton from '../../../sun/js/buttons/RectangularButton.js';
import Tandem from '../../../tandem/js/Tandem.js';
import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';

// constants
const ZOOMED_IN = 1;
const ZOOMED_OUT = 0.5;
const BUTTON_SPACING = 20;

type ZoomButtonGroupOptions = MagnifyingGlassZoomButtonGroupOptions;

export default class ZoomButtonGroup extends MagnifyingGlassZoomButtonGroup {
public static readonly ZOOMED_IN = ZOOMED_IN;
public static readonly ZOOMED_OUT = ZOOMED_OUT;

public constructor( selectedZoomProperty: NumberProperty, providedOptions?: MagnifyingGlassZoomButtonGroupOptions ) {
providedOptions = combineOptions<MagnifyingGlassZoomButtonGroupOptions>( {
public constructor( selectedZoomProperty: NumberProperty, providedOptions?: ZoomButtonGroupOptions ) {
providedOptions = combineOptions<ZoomButtonGroupOptions>( {
spacing: BUTTON_SPACING,
tandem: Tandem.REQUIRED,
buttonOptions: {
buttonAppearanceStrategy: RectangularButton.ThreeDAppearanceStrategy,
baseColor: PhetColorScheme.BUTTON_YELLOW
Expand Down

0 comments on commit 7167e37

Please sign in to comment.