I’m using Meteor and Typescript and would like to send a TypeScript object using Calls and Methods. I’ve noticed the object that is received when using Meteor.call()
is different to the object that is sent.
I’m expecting the uniqueColumns
field to be an array when received in the Meteor.call()
.
Class to send
export class Template {
_id: string;
userId: string;
uniqueColumns: string[] = [];
}
Meteor Method – uniqueColumns
is an array when printed
Meteor.methods({
getTemplates(): Array<Template> {
return TemplateCollectionManager.getInstance().getAll();
}
});
Meteor Call – uniqueColumns
is an Object
Meteor.call('getTemplates', null, (err: any, res: Array<Template>) => {
if (err) {
console.error(err);
} else {
console.log(res);
callback(res);
}
});
What is the correct method of sending/receiving a TypeScript object with Meteor Calls and Methods?