edusperoni / nativescript-mqtt

MQTT 3.1.1 for Nativescript
Apache License 2.0
12 stars 3 forks source link

Typescript error for Message (onMessageArrived) #3

Closed kabaluyot closed 5 years ago

kabaluyot commented 5 years ago

I followed the angular template using vue-template-ts and I got this error

image

edusperoni commented 5 years ago

Since message can be undefined, you can use .on((message?: Message) => {

kabaluyot commented 5 years ago

Can I little help with TS? :), image It says Object is possibly undefined

edusperoni commented 5 years ago

you can use:

if (message) {
// do stuff with message
}