phetsims / axon

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

DerivedProperty listener must provide all parameters to pass type check #375

Closed zepumph closed 2 years ago

zepumph commented 2 years ago

None of these parameters are used:

https://github.com/phetsims/ratio-and-proportion/blob/def1127874b5e2b7fe470f065a78549480789506/js/discover/view/DiscoverScreenSummaryNode.ts#L90

But if I remove them, then the DerivedProperty creation fails with this error:

TS2345: Argument of type '[Property, EnumerationProperty, Property, IReadOnlyProperty, IReadOnlyProperty<...>]' is not assignable to parameter of type '[]'.   Source has 5 element(s) but target allows only 0.

@jonathanolson, do you have any ideas about how to make this more flexible?

zepumph commented 2 years ago

Look what I just found as a workaround from a couple months ago.

https://github.com/phetsims/ratio-and-proportion/blob/95e7ea7adbc1522d9f518719664674f397d972be/js/common/view/BothHandsPDOMNode.ts#L218

Looks like you are likely aware of this problem then!

samreid commented 2 years ago

I think this was fixed in https://github.com/phetsims/axon/issues/395, closing (but please reopen if I'm wrong).