Author as string again
This commit is contained in:
parent
f7cfeb92bd
commit
4e626c8fdf
1 changed files with 2 additions and 2 deletions
|
@ -45,14 +45,14 @@ export function isServerMessage(
|
||||||
|
|
||||||
export type TextMessage = ServerMessage & {
|
export type TextMessage = ServerMessage & {
|
||||||
type: MessageType.TEXT;
|
type: MessageType.TEXT;
|
||||||
author: number;
|
author: string;
|
||||||
content: string;
|
content: string;
|
||||||
};
|
};
|
||||||
export function isTextMessage(obj: unknown): obj is TextMessage {
|
export function isTextMessage(obj: unknown): obj is TextMessage {
|
||||||
if (!isServerMessage(obj, MessageType.TEXT)) return false;
|
if (!isServerMessage(obj, MessageType.TEXT)) return false;
|
||||||
if (
|
if (
|
||||||
!Object.hasOwnProperty.call(obj, "author") ||
|
!Object.hasOwnProperty.call(obj, "author") ||
|
||||||
typeof (obj as ServerMessage & { author: unknown }).author !== "number"
|
typeof (obj as ServerMessage & { author: unknown }).author !== "string"
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue