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 = {
|
export type ServerMessage = {
|
||||||
|
__ctx?: string;
|
||||||
type: MessageType;
|
type: MessageType;
|
||||||
date: number;
|
date: number;
|
||||||
};
|
};
|
||||||
|
@ -31,6 +32,13 @@ export function isServerMessage(
|
||||||
) {
|
) {
|
||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
Reference in a new issue