You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While it is possible to generically divide any unit by any other unit and get a new unit that works for conversion, it is not possible to get the type of the new unit because we don't know which quantity it should get. To solve that UnitTimes and UnitDivide exists and they support dividing certain units by other units, and returning a correctly typed unit in the resulting quantity.
However it is still not possible to have a generic Amount.divide or Amount.times.
This might be solvable by using conditional types in typescript. Something like:
While it is possible to generically divide any unit by any other unit and get a new unit that works for conversion, it is not possible to get the type of the new unit because we don't know which quantity it should get. To solve that
UnitTimes
andUnitDivide
exists and they support dividing certain units by other units, and returning a correctly typed unit in the resulting quantity.However it is still not possible to have a generic Amount.divide or Amount.times.
This might be solvable by using conditional types in typescript. Something like:
The text was updated successfully, but these errors were encountered: