Fix types

This commit is contained in:
Robin Townsend 2022-08-02 13:31:11 -04:00
parent 9b915d289b
commit 89312ceb58

View file

@ -231,7 +231,7 @@ function reducer(
action: { action: {
type?: CallEvent | ClientEvent | RoomStateEvent; type?: CallEvent | ClientEvent | RoomStateEvent;
event?: MatrixEvent; event?: MatrixEvent;
rawEvent?: object; rawEvent?: Record<string, unknown>;
callStateEvent?: MatrixEvent; callStateEvent?: MatrixEvent;
memberStateEvents?: MatrixEvent[]; memberStateEvents?: MatrixEvent[];
} }
@ -321,7 +321,7 @@ function reducer(
const event = action.rawEvent; const event = action.rawEvent;
const eventsByUserId = { ...state.eventsByUserId }; const eventsByUserId = { ...state.eventsByUserId };
const fromId = state.localUserId; const fromId = state.localUserId;
const toId = event.userId; const toId = event.userId as string;
const remoteUserIds = eventsByUserId[toId] const remoteUserIds = eventsByUserId[toId]
? state.remoteUserIds ? state.remoteUserIds
@ -332,8 +332,8 @@ function reducer(
{ {
from: fromId, from: fromId,
to: toId, to: toId,
type: event.eventType, type: event.eventType as string,
content: event.content, content: event.content as CallEventContent,
timestamp: Date.now(), timestamp: Date.now(),
ignored: false, ignored: false,
}, },
@ -383,7 +383,7 @@ function useGroupCallState(
dispatch({ type: ClientEvent.ReceivedVoipEvent, event }); dispatch({ type: ClientEvent.ReceivedVoipEvent, event });
} }
function onSendVoipEvent(event: object) { function onSendVoipEvent(event: Record<string, unknown>) {
dispatch({ type: CallEvent.SendVoipEvent, rawEvent: event }); dispatch({ type: CallEvent.SendVoipEvent, rawEvent: event });
} }
client.on(RoomStateEvent.Events, onUpdateRoomState); client.on(RoomStateEvent.Events, onUpdateRoomState);