Add __ctx to Messages for optional comments. Move ServerMessage.ts up
This commit is contained in:
parent
7746e3ebdd
commit
f7cfeb92bd
1 changed files with 8 additions and 0 deletions
|
@ -4,6 +4,7 @@ export enum MessageType {
|
|||
}
|
||||
|
||||
export type ServerMessage = {
|
||||
__ctx?: string;
|
||||
type: MessageType;
|
||||
date: number;
|
||||
};
|
||||
|
@ -31,6 +32,13 @@ export function isServerMessage(
|
|||
) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
Object.hasOwnProperty.call(obj, "__ctx") &&
|
||||
typeof (obj as { __ctx: unknown }).__ctx !== "string" &&
|
||||
typeof (obj as { __ctx: unknown }).__ctx !== "undefined"
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
Reference in a new issue