Closed as not planned
Description
openedon Apr 30, 2017
When defining a type one can specify multiple numbers separated by |
.
type TTerminalColors = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
Allow to specify number types as ranges, instead of listing each number:
type TTerminalColors = 0..15;
type TRgbColorComponent = 0..255;
type TUInt = 0..4294967295;
Maybe use ..
for integers and ...
for floats.
interface Math {
random(): 0...1
}
type RandomDice = 1..6;
const roll: RandomDice = Math.floor(Math.random() * 6);
// Error: -------------------------^ Maybe use Math.ceil()?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment