Presently sponsored by Serverless Guru: Your guide to cloud excellence, helping you every step of your serverless journey, including team training, pattern development, mass service migrations, architecting, and developing new solutions. Speak to a Guru today.
You can specify a function which can take in a numeric value with a generic unit of measure easily enough:
Similarly, you can also specify a discriminated union whose clauses can be of a numeric value with a generic unit of measure, like this: