Typescript Error in email composer


#1

Hi,
if I try to build my app, I get this error in my email-composer:

[19:23:16] typescript: C:/Users/Robert/count/src/pages/mail/mail.ts, line: 56
Argument of type ‘{ to: string; subject: string; body: string[]; isHtml: boolean; }’ is not assignable to
parameter of type ‘EmailComposerOptions’. Types of property ‘body’ are incompatible. Type ‘string[]’ is not
assignable to type ‘string’.
L55: };
L56: this.emailComposer.open(email);

And this is my code the error refers to:

  send(){
	  console.log('Email sended');
	  let email = {
			to: this.to,
			subject: this.subject,
			body: [
			this.title + " ||Results|| " + "Counted: " + this.global.count + "/" + this.global.goal + " ||ITEMS|| ",
			],
			isHtml: true
	};
	this.emailComposer.open(email); //line 56 (where the error should be (this.emailComposer.open(**email**);))
  }

If you got any ideas how to fix it, I would be very thankfully.

Greetings,
Robert


#2

Like the error states, body needs to be a string and not a string[].

Change body to

body: this.title + " ||Results|| " + "Counted: " + this.global.count + "/" + this.global.goal + " ||ITEMS|| "

#3

Thanks, this solves my problem.