Hi, this might just be my own inexperience, but how would you correctly reference a JourneyApps interface inside a function? I would like to use instanceof
to see what type of object I am receiving.
Here is the code:
function getMemberName(_member: DB.member | DB.interaction): string {
if (_member instanceof DB.member) {
return `${_member.name} ${_member.surname}`
} else {
return `${_member.member_name} ${_member.member_surname}`;
}
}
I am however getting the following error:
(property) DB.member: Collection<DB.member>
The right-hand side of an ‘instanceof’ expression must be of type ‘any’ or of a type assignable to the ‘Function’ interface type.ts(2359)
at DB.member in this line: if (_member instanceof DB.member) {