I'm trying to learn TypeScript (2.1) by creating a dice roller. I figured I'd use tuples to match up the side rolled with a picture. For example, if I roll a 1 (using a random number generator I plan on implementing), I get back the representation for a circle.
class D6 {
values: [number, string];
values = [1, "Circle"];
}
However, just with that little bit of code, I am getting this error:
Subsequent variable declarations must have the same type. Variable 'values' must be of type '[number, string]', but here has type '(string | number)[]'.
Is it possible to use tuples in a class in TypeScript?