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 & {
|
||||
type: MessageType.TEXT;
|
||||
author: number;
|
||||
author: string;
|
||||
content: string;
|
||||
};
|
||||
export function isTextMessage(obj: unknown): obj is TextMessage {
|
||||
if (!isServerMessage(obj, MessageType.TEXT)) return false;
|
||||
if (
|
||||
!Object.hasOwnProperty.call(obj, "author") ||
|
||||
typeof (obj as ServerMessage & { author: unknown }).author !== "number"
|
||||
typeof (obj as ServerMessage & { author: unknown }).author !== "string"
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
|
Reference in a new issue