phetsims / axon

Axon provides powerful and concise models for interactive simulations, based on observable Properties and related patterns.
MIT License
10 stars 8 forks source link

Fix Property.link signature and call sites #365

Closed samreid closed 2 years ago

samreid commented 2 years ago

@chrisklus discovered that TypeScript should be inferring the Property.link callback parameters, but it isn't, due to numerous syntax errors in the Property JSDoc. I'll fix it and update call sites.

samreid commented 2 years ago

The changes above make it so it is now redundant to specify the type information in Property.link callbacks.

Old code:

representationProperty.link( ( representation: Representation ) => {

New Code:

representationProperty.link( representation => {

However, this doesn't yet work with Property subtypes like BooleanProperty, NumberProperty, etc. I'll remove the redundant type information from a few sims in the upcoming commits.

samreid commented 2 years ago

@chrisklus this was more involved than I anticipated. Can you spot check?

chrisklus commented 2 years ago

@samreid and I looked over some cases together where I had questions and I just spot checked the rest of the commits. Looking good, closing.