Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit e1bc97a

Browse files
committed
Fix strict type checks
1 parent f38df06 commit e1bc97a

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

src/hooks/useAudioDeviceTooltipSelection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ interface State {
3232
}
3333

3434
export const useAudioDeviceTooltipSelection = (
35-
containerRef: MutableRefObject<HTMLElement>,
35+
containerRef: MutableRefObject<HTMLElement | null>,
3636
onDeviceChanged?: (device: MediaDeviceInfo) => void,
3737
) => {
3838
const shouldRequestPermissionsRef = useRef<boolean>(true);

src/voice-broadcast/components/molecules/VoiceBroadcastPreRecordingPip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ interface Props {
3030
export const VoiceBroadcastPreRecordingPip: React.FC<Props> = ({
3131
voiceBroadcastPreRecording,
3232
}) => {
33-
const pipRef = useRef<HTMLDivElement>(null);
33+
const pipRef = useRef<HTMLDivElement | null>(null);
3434
const { deviceLabel, devicesMenu, onSelectDeviceClick } = useAudioDeviceTooltipSelection(pipRef);
3535

3636
return <div

src/voice-broadcast/hooks/useVoiceBroadcastRecording.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ const showStopBroadcastingDialog = async (): Promise<boolean> => {
4747

4848
export const useVoiceBroadcastRecording = (recording: VoiceBroadcastRecording) => {
4949
const client = MatrixClientPeg.get();
50-
const room = client.getRoom(recording.infoEvent.getRoomId());
50+
const roomId = recording.infoEvent.getRoomId();
51+
const room = client.getRoom(roomId);
52+
53+
if (!room) {
54+
throw new Error("Unable to find voice broadcast room with Id: " + roomId);
55+
}
56+
5157
const stopRecording = async () => {
5258
const confirmed = await showStopBroadcastingDialog();
5359

test/voice-broadcast/components/molecules/VoiceBroadcastPreRecordingPip-test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ describe("VoiceBroadcastPreRecordingPip", () => {
4949

5050
beforeEach(() => {
5151
client = stubClient();
52-
room = new Room("!room@example.com", client, client.getUserId());
53-
sender = new RoomMember(room.roomId, client.getUserId());
52+
room = new Room("!room@example.com", client, client.getUserId() || "");
53+
sender = new RoomMember(room.roomId, client.getUserId() || "");
5454
recordingsStore = new VoiceBroadcastRecordingsStore();
5555
mocked(requestMediaPermissions).mockReturnValue(new Promise<MediaStream>((r) => {
5656
r({
5757
getTracks: () => [],
58-
} as MediaStream);
58+
} as unknown as MediaStream);
5959
}));
6060
jest.spyOn(MediaDeviceHandler, "getDevices").mockResolvedValue({
6161
[MediaDeviceKindEnum.AudioInput]: [

test/voice-broadcast/components/molecules/VoiceBroadcastRecordingPip-test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ describe("VoiceBroadcastRecordingPip", () => {
6565
infoEvent = mkVoiceBroadcastInfoStateEvent(
6666
roomId,
6767
state,
68-
client.getUserId(),
69-
client.getDeviceId(),
68+
client.getUserId() || "",
69+
client.getDeviceId() || "",
7070
);
7171
recording = new VoiceBroadcastRecording(infoEvent, client, state);
7272
jest.spyOn(recording, "pause");
@@ -82,7 +82,7 @@ describe("VoiceBroadcastRecordingPip", () => {
8282
mocked(requestMediaPermissions).mockReturnValue(new Promise<MediaStream>((r) => {
8383
r({
8484
getTracks: () => [],
85-
} as MediaStream);
85+
} as unknown as MediaStream);
8686
}));
8787
jest.spyOn(MediaDeviceHandler, "getDevices").mockResolvedValue({
8888
[MediaDeviceKindEnum.AudioInput]: [

0 commit comments

Comments
 (0)