I\'m playing with Typescript and I wonder, how to properly instantiate and declare multidimensional array. Here\'s my code:
class Something {
private thi
You can do the following (which I find trivial, but its actually correct). For anyone trying to find how to initialize a two-dimensional array in TypeScript (like myself).
Let's assume that you want to initialize a two-dimensional array, of any type. You can do the following
const myArray: any[][] = [];
And later, when you want to populate it, you can do the following:
myArray.push([
A short example of the above can be the following:
const myArray: string[][] = [];
myArray.push(["value1", "value2"]);