Do Partials Create Un-Typesafe Code?

If I am listening for say a message update event with partials of messages and I receive a partial message in that event with only the ID and no other information, is it possible for me to access a value that doesn’t exist on the object sent to the event listener?

My assumption would be there’s a Message type and a PartialMessage type and the onMessageUpdate() event listener would give a PartialMessage | Message and you’d use the .partial property to determine the state of it

From the docs though it only sends a message object which could be partially constructed, resulting in accessing a property that’s null - creating a runtime error that could have been caught with types?
Was this page helpful?