I have this code:
const BlockConstructors: Function[] = [
OBlock,
IBlock,
TBlock
];
function randomFromArray(array: any[]) {
return array[Math.floor( Math.random() * array.length )];
}
const BlockConstructor: Function = random(BlockConstructors);
const block: Block = new BlockConstructor();
I try to draw a some block constructor from array and then create a new object, all my block constructors in array extends Block class. I get error:
Cannot use 'new' with an expression whose type lacks a call or construct signature.
Why this error appears?