I am working with an interface called ITreeNode that looks like this -
export interface ITreeNode {
values: string[];
key: string;
isSubHeader?: boolean;
hours?: number[];
children?: ITreeNode[];
}
My goal is to create a temporary object based on this interface and then populate its properties sequentially from different sources.
However, when I try to assign a value to the 'key' property of the temporary object, I get an error message stating
cannot assign value to property 'key' of undefined
-
let node: ITreeNode;
node.key = "Something";
How can I resolve this issue?