I have this MessageType extracted from a .proto file:
export type MessageType = {
template_id: number
}
The decode function shows:
Maybe the protobuf library expects to extend with the above Object Type
class Message<T extends object = object>
Doing so it results in not finding the type.
import protobuf from 'protobufjs'
...
const { template_id }:protobuf.Message<MessageType> = decode(payload)
Property 'template_id' does not exist on type 'Message'.ts(2339)
I tried fixing it by using unknown
keyword, but this can't be the solution?
decode(payload) as unknown as MessageType