BREAKING CHANGE: v0.16 `Room.has(contact)` change from Sycn to Async
Created by: huan
WARNING: This change will let us make more mistakes:
if (room.has(contact)) {
console.error('here will always be executed because Promise === true')
}
So we have to enable tslint to check the floating promise for us. So should all the developers do if you are using Wechaty:
Related configuration in tslint.json:
{
"extends": "tslint:recommended",
"rules": {
"no-floating-promises": true
}
}
See Also
Before
const exist = room.has(contact)
After
const exist = await room.has(contact)