The translation is correct, the typing of the expression isn't. TypeScript is incorrectly typing the expression new Thing[100]
as an array. It should be an error to index Thing
, a constructor function, using the index operator. In C# this would allocate an array of 100 elements. In JavaScript this calls the value at index 100 of Thing
as if was a constructor. Since that values is undefined
it raises the error you mentioned. In JavaScript and TypeScript you want new Array(100)
instead.
You should report this as a bug on CodePlex.