Just dipping my toes into TypeScript here, so forgive me if I'm making a rookie mistake. Here's the code snippet I've got:
const gCharData: any = {};
function buildChar()
{
const key = "Char1";
let currentChar = gCharData[key];
if (!currentChar) {
currentChar = {
name: "Jack",
parts: new Set(),
};
gCharData[key] = currentChar;
}
currentChar.parts.add("Head");
}
function foo(chars: { [x: string]: any; })
{
for (var charName in chars) {
const details = chars[charName];
for (var name of details.parts) {
/*NOT EXCUTING*/
}
}
}
function main()
{
buildChar()
foo(gCharData)
}
main();
However, the second for loop is not running. Any ideas why this might be happening?
Thanks a bunch!