| ▲ | kennywinker 4 hours ago | ||||||||||||||||
Casting? Not really - i think you’d only need a couple type checks. Imo this is mostly useful for situations where you want to handle input validation (and errors) in the UI code and this function lives far away from ui code. Your point about clamping makes sense, and it’s probably worth doing that anyway, but without it being encoded in the type you have to communicate how the function is intended to be used some other way. | |||||||||||||||||
| ▲ | samdoesnothing 3 hours ago | parent [-] | ||||||||||||||||
How would you convert a Number type to a ClampedNumber type without casting? | |||||||||||||||||
| |||||||||||||||||