diff --git a/js/common/model/Body.ts b/js/common/model/Body.ts index 249cc78a..dbfc1347 100644 --- a/js/common/model/Body.ts +++ b/js/common/model/Body.ts @@ -236,7 +236,7 @@ export default class Body extends PhetioObject { // rewindable properties - body states can be rewound, and these properties can have saved states to support this this.positionProperty = new RewindableProperty( changeRewindValueProperty, new Vector2( bodyConfiguration.x, bodyConfiguration.y ), { - phetioType: RewindableProperty.RewindablePropertyIO( Vector2.Vector2IO ), + phetioValueType: Vector2.Vector2IO, tandem: tandem.createTandem( 'positionProperty' ), units: 'm', phetioHighFrequency: true, @@ -244,7 +244,7 @@ export default class Body extends PhetioObject { } ); this.velocityProperty = new RewindableProperty( changeRewindValueProperty, new Vector2( bodyConfiguration.vx, bodyConfiguration.vy ), { - phetioType: RewindableProperty.RewindablePropertyIO( Vector2.Vector2IO ), + phetioValueType: Vector2.Vector2IO, tandem: tandem.createTandem( 'velocityProperty' ), units: 'm/s', phetioHighFrequency: true, @@ -252,7 +252,7 @@ export default class Body extends PhetioObject { } ); this.speedProperty = new DerivedProperty( [ this.velocityProperty ], velocity => velocity.magnitude, { - phetioType: DerivedProperty.DerivedPropertyIO( NumberIO ), + phetioValueType: NumberIO, tandem: tandem.createTandem( 'speedProperty' ), units: 'm/s', phetioHighFrequency: true, @@ -261,7 +261,7 @@ export default class Body extends PhetioObject { this.forceProperty = new RewindableProperty( changeRewindValueProperty, new Vector2( 0, 0 ), { phetioDocumentation: 'The net force of gravity exerted on this body by other bodies', - phetioType: RewindableProperty.RewindablePropertyIO( Vector2.Vector2IO ), + phetioValueType: Vector2.Vector2IO, tandem: tandem.createTandem( 'forceProperty' ), phetioHighFrequency: true, units: 'N', @@ -270,7 +270,7 @@ export default class Body extends PhetioObject { this.forceMagnitudeProperty = new DerivedProperty( [ this.forceProperty ], force => force.magnitude, { phetioDocumentation: 'The magnitude of the net force on this body by other bodies', - phetioType: DerivedProperty.DerivedPropertyIO( NumberIO ), + phetioValueType: NumberIO, tandem: tandem.createTandem( 'forceMagnitudeProperty' ), phetioHighFrequency: true, units: 'N' @@ -278,21 +278,21 @@ export default class Body extends PhetioObject { this.massProperty = new RewindableProperty( changeRewindValueProperty, bodyConfiguration.mass, { tandem: tandem.createTandem( 'massProperty' ), - phetioType: RewindableProperty.RewindablePropertyIO( NumberIO ), + phetioValueType: NumberIO, units: 'kg', phetioDocumentation: 'The mass of the body' } ); this.isCollidedProperty = new RewindableProperty( changeRewindValueProperty, false, { tandem: tandem.createTandem( 'isCollidedProperty' ), - phetioType: RewindableProperty.RewindablePropertyIO( BooleanIO ), + phetioValueType: BooleanIO, phetioReadOnly: true, phetioDocumentation: 'True if the body has collided with another body' } ); this.rotationProperty = new RewindableProperty( changeRewindValueProperty, 0, { tandem: tandem.createTandem( 'rotationProperty' ), - phetioType: RewindableProperty.RewindablePropertyIO( NumberIO ), + phetioValueType: NumberIO, units: 'radians', phetioHighFrequency: true, phetioDocumentation: 'The rotation of the body about its own origin' diff --git a/js/common/model/GravityAndOrbitsModel.ts b/js/common/model/GravityAndOrbitsModel.ts index 2425cdd1..db79744e 100644 --- a/js/common/model/GravityAndOrbitsModel.ts +++ b/js/common/model/GravityAndOrbitsModel.ts @@ -85,7 +85,7 @@ class GravityAndOrbitsModel { this.sceneProperty = new Property( this.sceneList.scenes[ 0 ], { tandem: tandem.createTandem( 'sceneProperty' ), validValues: this.sceneList.scenes, - phetioType: Property.PropertyIO( ReferenceIO( IOType.ObjectIO ) ) + phetioValueType: ReferenceIO( IOType.ObjectIO ) } ); } diff --git a/js/common/model/Pair.ts b/js/common/model/Pair.ts index 6f3a62d1..77fd4d8a 100644 --- a/js/common/model/Pair.ts +++ b/js/common/model/Pair.ts @@ -29,7 +29,7 @@ class Pair { this.body2.positionProperty ], ( body1Position, body2Position ) => body2Position.distance( body1Position ), { tandem: tandem.createTandem( 'distanceProperty' ), - phetioType: DerivedProperty.DerivedPropertyIO( NumberIO ), + phetioValueType: NumberIO, phetioHighFrequency: true, units: 'm' } ); diff --git a/js/common/model/RewindableProperty.ts b/js/common/model/RewindableProperty.ts index 3f57d1bc..a66cc25a 100644 --- a/js/common/model/RewindableProperty.ts +++ b/js/common/model/RewindableProperty.ts @@ -10,18 +10,19 @@ */ import BooleanProperty from '../../../../axon/js/BooleanProperty.js'; -import Property from '../../../../axon/js/Property.js'; +import Property, { PropertyOptions } from '../../../../axon/js/Property.js'; import gravityAndOrbits from '../../gravityAndOrbits.js'; import Tandem from '../../../../tandem/js/Tandem.js'; import IOType from '../../../../tandem/js/types/IOType.js'; import { PhetioObjectOptions } from '../../../../tandem/js/PhetioObject.js'; import TReadOnlyProperty from '../../../../axon/js/TReadOnlyProperty.js'; import { combineOptions } from '../../../../phet-core/js/optionize.js'; +import StrictOmit from '../../../../phet-core/js/types/StrictOmit.js'; -type RewindablePropertyOptions = { +type RewindablePropertyOptions = { units?: string; tandem: Tandem; -} & PhetioObjectOptions; +} & StrictOmit & Pick, 'phetioOuterType' | 'phetioValueType'>; class RewindableProperty extends Property { private rewindValue: T; @@ -35,10 +36,11 @@ class RewindableProperty extends Property { * @param value * @param [providedOptions] */ - public constructor( changeRewindValueProperty: TReadOnlyProperty, value: T, providedOptions?: RewindablePropertyOptions ) { + public constructor( changeRewindValueProperty: TReadOnlyProperty, value: T, providedOptions?: RewindablePropertyOptions ) { - const options = combineOptions( { - tandem: Tandem.OPTIONAL + const options = combineOptions>( { + tandem: Tandem.OPTIONAL, + phetioOuterType: RewindableProperty.RewindablePropertyIO }, providedOptions ); super( value, options );