Author as string again

This commit is contained in:
Tobias Berger 2022-01-08 17:12:38 +01:00
parent f7cfeb92bd
commit 4e626c8fdf

View file

@ -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;
}