phetsims / sun

User-interface components for PhET simulations, built on top of Scenery.
MIT License
4 stars 12 forks source link

TypeScript conversion of `*ButtonInteractionStateProperty` classes #750

Closed pixelzoom closed 2 years ago

pixelzoom commented 2 years ago

I'm converting *ToggleButtonInteractionStateProperty classes to TypeScript, and encountering enough incorrect JSdoc type expressions that I'm concerned. So I'm creating this issue to track my changes, and have @jbphet review when I'm done.

pixelzoom commented 2 years ago

@jbphet please review.

The main problem I encountered is that all of the constructors indicated @param {ButtonModel} buttonModel. And that definitely was not the case, there were specific subclasses of ButtonModel that were needed.

I also had to make some fields public in ToggleButtonModel and StickyToggleButtonModel.

jbphet commented 2 years ago

Changes look good. Having the greater specificity for the model types needed in these derived types is a good improvement. I added the direct export of the class declaration that had been done for the other files to PushButtonInteractionStateProperty for consistency and did some edits on the comments.

I also changed the title of this issue since, as originally written, it described a smaller set of files than were actually changed.

@pixelzoom - I'm reasonably certain that none of this would be controversial with you, so I'm going to close. You're welcome to look it over if you see it go by.