I have the following typescript function:
function normalize(value: number) {
if (value < 0 || value > 30) {
throw "The value should be between 0 and 30";
}
}
Is there a way to write the function to display the exception compile time instead of run time?
Something like this:
function normalize(value: [0 - 30]) {
f (value < 0 || value > 30) {
throw "The value should be between 0 and 30";
}
}