When defining a TypeScript class like this:
export class myClass {
constructor(public aVariable: number) {}
private aPrivateVariable: number;
}
and trying to initialize it with the following code:
let someVar: myClass[] = [{
aVariable: 3
}, {
aVariable: 2
}];
An error, typically in VS Code, is thrown stating:
The property 'aPrivateVariable' is missing in type '{ aVariable: number; }'.
This brings up the question: Why am I unable to do this?
Thank you.