I am very new to TypeScript so I'm hoping this is ...
# typescript
b
I am very new to TypeScript so I'm hoping this is an easy question for someone else. I have a functional loop that is creating/importing our IAM groups from a text file: const groupsList = (fs.readFileSync('groups.txt')).toString().split('\n') let groups = []; for (let group in groupsList) { groups.push(new aws.iam.Group(groupsList[group], {name: groupsList[group]}, {import: groupsList[group]})); } export let groupNames = groups.map(s => s.name); Later on, I want to re-use the created groups in a aws.iam.GroupPolicyAttachment resource: const groupPolicyAttachment = new aws.iam.GroupPolicyAttachment("testGroupoAttachment", { group: (<groupType export goes here>})), policyArn: testPolicy.arn }); The groupPolicyAttachment doesn't accept a string value for group attribute. I'm trying to figure out how to get the original groupType from the original loop. The current export was just a test, but again, I end up with a string value.
q
export let groupNames = groups.map(s => s.name);
you got string group because you did map() here