I am having a problem where I have a method where I have a data structure:
const req = {
ctx: {
emails: [],
newInvitationDto: {
_type: 'NewInvitationDto',
email: 'sethborne@gmail.com',
groupId: '12345678',
roleIds: ['organization.doctor'],
firstName: 'Seth',
lastName: 'Borne',
title: 'Doctor',
phone: '212.555.1212',
},
},
};
that comes from const ctx: Invitation = <Invitation>req.ctx
, So when I console log ctx.emails
I get an empty array.
Now when I try to push the value of email
, that is 'sethborne@gmail.com'
into the ctx.emails
like so: ctx.emails.push(newInvitationDto.email)
instead of getting a data structure like so:
['sethborne@gmail.com']
instead I get value of 1
.
I believe something is wrong with my assignment, but not sure what it is.