# typescript


11/11/2019, 1:32 PM
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 = =>; 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.


11/28/2019, 10:58 PM
export let groupNames = =>;
you got string group because you did map() here