Skip to content

Commit

Permalink
fix type problems, #1641
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Kauzmann <[email protected]>
  • Loading branch information
zepumph committed Jul 9, 2024
1 parent c3bece4 commit a38712b
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions js/util/GatedVisibleProperty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,39 @@ import StrictOmit from '../../../phet-core/js/types/StrictOmit.js';

type SelfOptions = {
selfVisibleInitiallyVisible?: boolean;
selfVisiblePropertyOptions: StrictOmit<BooleanPropertyOptions<boolean>, 'tandem'>;
selfVisiblePropertyOptions?: BooleanPropertyOptions;
};
type ParentOptions = DerivedPropertyOptions<boolean>;
type GatedVisiblePropertyOptions = SelfOptions & StrictOmit<ParentOptions, 'tandem'>;

class GatedVisibleProperty extends DerivedProperty2<boolean, boolean, boolean> {
public readonly selfVisibleProperty: TProperty<boolean>;

public constructor( providedVisibleProperty: TReadOnlyProperty<boolean>, tandem: Tandem, providedOptions?: GatedVisiblePropertyOptions ) {
public constructor( providedVisibleProperty: TReadOnlyProperty<boolean>, parentTandem: Tandem, providedOptions?: GatedVisiblePropertyOptions ) {

const options = optionize<GatedVisiblePropertyOptions, SelfOptions, ParentOptions>()( {
selfVisibleInitiallyVisible: true,
selfVisiblePropertyOptions: {
tandem: tandem.createTandem( 'selfVisibleProperty' ),
tandem: parentTandem.createTandem( 'selfVisibleProperty' ),
phetioFeatured: true,
phetioDocumentation: 'Provides an additional way to toggle the visibility for the PhET-iO Element.'
},

tandem: tandem.createTandem( 'visibleProperty' ),
phetioValueType: BooleanIO,
phetioDocumentation: null
tandem: parentTandem.createTandem( 'visibleProperty' ),
phetioValueType: BooleanIO
// see below for phetioDocumentation
}, providedOptions );

const selfVisibleProperty = new BooleanProperty( options.selfVisibleInitiallyVisible, options.selfVisiblePropertyOptions );
if ( !options.phetioDocumentation ) {
options.phetioDocumentation = `Whether the PhET-iO Element is visible, see ${selfVisibleProperty.tandem.name} for customization.`;
}

super( [ providedVisibleProperty, selfVisibleProperty ],
( providedVisible, selfVisible ) => providedVisible && selfVisible, options );
super(
[ providedVisibleProperty, selfVisibleProperty ],
( providedVisible, selfVisible ) => providedVisible && selfVisible,
options
);

this.selfVisibleProperty = selfVisibleProperty;
}
Expand Down

0 comments on commit a38712b

Please sign in to comment.