diff --git a/js/common/model/Field.ts b/js/common/model/Field.ts index 6079123..1898c71 100644 --- a/js/common/model/Field.ts +++ b/js/common/model/Field.ts @@ -357,7 +357,7 @@ export default abstract class Field extends PhetioObject { } } - private toStateObject(): object { + private toStateObject(): FieldStateObject { return { airborneProjectiles: this.airborneProjectiles.map( projectile => Projectile.ProjectileIO.toStateObject( projectile ) ), landedProjectiles: this.landedProjectiles.map( projectile => Projectile.ProjectileIO.toStateObject( projectile ) ) @@ -380,7 +380,7 @@ export default abstract class Field extends PhetioObject { landedProjectiles: ArrayIO( Projectile.ProjectileIO ) }, toStateObject: field => field.toStateObject(), - applyState: ( field: Field, stateObject ) => { + applyState: ( field: Field, stateObject: FieldStateObject ) => { field.airborneProjectiles.length = 0; field.landedProjectiles.length = 0; @@ -396,4 +396,9 @@ export default abstract class Field extends PhetioObject { } ); } +type FieldStateObject = { + airborneProjectiles: ProjectileStateObject[]; + landedProjectiles: ProjectileStateObject[]; +}; + projectileDataLab.register( 'Field', Field ); \ No newline at end of file