What's the difference between the following declarations:
var num1: [number];var num2: number[];var num3: Array<number>;
It seems that num2 and num3 are interchangeable, but what about num1?
Which declaration should I use when?
What's the difference between the following declarations:
var num1: [number];var num2: number[];var num3: Array<number>;It seems that num2 and num3 are interchangeable, but what about num1?
Which declaration should I use when?
1 is a tuple type, so in this case num1 must be a 1-element array containing a number. If you declare it as var num1: [number, string, string]; then num1 must be a 3-element array containing a number, a string and another string in that order.
2 and 3 are identical; it doesn't matter which one you use.