Closed FourwingsY closed 1 year ago
function isControlMessage(message: InAppMessage | ControlMessage): message is ControlMessage { return message.isControl === true // or whatever // return message instanceof ControlMessage }
This function does not works.
The main problem is ControlMessage is absolute subset of InAppMessage
ControlMessage
InAppMessage
So, making small difference with it will makes typescript distinguish between them.
While I tried some tests in TS playground, this fix will make it work.
class ControlMessage { ... isControl: true // from boolean }
No response
Hi @FourwingsY. Thanks for bringing this to our attention. We'll include this in our next release.
Hi @FourwingsY , we have included this in our most recent SDK release v4.8.1. Thanks again!
What problem are you facing?
This function does not works.
Workarounds
The main problem is
ControlMessage
is absolute subset ofInAppMessage
So, making small difference with it will makes typescript distinguish between them.
Ideal Solution
While I tried some tests in TS playground, this fix will make it work.
Other Information
No response