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
It is also very deceptive, because if you remove the explicity typing of foo, its type is correct ( Amount.Amount<"Duration">), but that will still not prevent assigning it to the wrong type.
Due to
Amount
being a generic, with a type parameterT extends Quantity.Quantity
, allAmount
s are interchangeable.This happens since
T extends Quantity.Quantity
won't give you one of the types in the unionQuantity.Quantity
, but all types that extends any of them.https://github.com/dividab/uom/blob/master/src/amount.ts#L11
In essence, this is totally OK:
It is also very deceptive, because if you remove the explicity typing of
foo
, its type is correct (Amount.Amount<"Duration">
), but that will still not prevent assigning it to the wrong type.References:
The text was updated successfully, but these errors were encountered: