Conform more of the codebase to strictNullChecks
(#10350
* Conform more of the codebase to `strictNullChecks` * Iterate * Generics ftw * Iterate
This commit is contained in:
parent
d53e91802d
commit
127a3b667c
53 changed files with 279 additions and 263 deletions
|
@ -61,7 +61,7 @@ const RoomContextMenu: React.FC<IProps> = ({ room, onFinished, ...props }) => {
|
|||
RoomListStore.instance.getTagsForRoom(room),
|
||||
);
|
||||
|
||||
let leaveOption: JSX.Element;
|
||||
let leaveOption: JSX.Element | undefined;
|
||||
if (roomTags.includes(DefaultTagID.Archived)) {
|
||||
const onForgetRoomClick = (ev: ButtonEvent): void => {
|
||||
ev.preventDefault();
|
||||
|
@ -112,7 +112,7 @@ const RoomContextMenu: React.FC<IProps> = ({ room, onFinished, ...props }) => {
|
|||
const isVideoRoom =
|
||||
videoRoomsEnabled && (room.isElementVideoRoom() || (elementCallVideoRoomsEnabled && room.isCallRoom()));
|
||||
|
||||
let inviteOption: JSX.Element;
|
||||
let inviteOption: JSX.Element | undefined;
|
||||
if (room.canInvite(cli.getUserId()!) && !isDm) {
|
||||
const onInviteClick = (ev: ButtonEvent): void => {
|
||||
ev.preventDefault();
|
||||
|
@ -136,9 +136,9 @@ const RoomContextMenu: React.FC<IProps> = ({ room, onFinished, ...props }) => {
|
|||
);
|
||||
}
|
||||
|
||||
let favouriteOption: JSX.Element;
|
||||
let lowPriorityOption: JSX.Element;
|
||||
let notificationOption: JSX.Element;
|
||||
let favouriteOption: JSX.Element | undefined;
|
||||
let lowPriorityOption: JSX.Element | undefined;
|
||||
let notificationOption: JSX.Element | undefined;
|
||||
if (room.getMyMembership() === "join") {
|
||||
const isFavorite = roomTags.includes(DefaultTagID.Favourite);
|
||||
favouriteOption = (
|
||||
|
@ -208,8 +208,8 @@ const RoomContextMenu: React.FC<IProps> = ({ room, onFinished, ...props }) => {
|
|||
);
|
||||
}
|
||||
|
||||
let peopleOption: JSX.Element;
|
||||
let copyLinkOption: JSX.Element;
|
||||
let peopleOption: JSX.Element | undefined;
|
||||
let copyLinkOption: JSX.Element | undefined;
|
||||
if (!isDm) {
|
||||
peopleOption = (
|
||||
<IconizedContextMenuOption
|
||||
|
@ -247,7 +247,7 @@ const RoomContextMenu: React.FC<IProps> = ({ room, onFinished, ...props }) => {
|
|||
);
|
||||
}
|
||||
|
||||
let filesOption: JSX.Element;
|
||||
let filesOption: JSX.Element | undefined;
|
||||
if (!isVideoRoom) {
|
||||
filesOption = (
|
||||
<IconizedContextMenuOption
|
||||
|
@ -266,9 +266,9 @@ const RoomContextMenu: React.FC<IProps> = ({ room, onFinished, ...props }) => {
|
|||
}
|
||||
|
||||
const pinningEnabled = useFeatureEnabled("feature_pinning");
|
||||
const pinCount = usePinnedEvents(pinningEnabled && room)?.length;
|
||||
const pinCount = usePinnedEvents(pinningEnabled ? room : undefined)?.length;
|
||||
|
||||
let pinsOption: JSX.Element;
|
||||
let pinsOption: JSX.Element | undefined;
|
||||
if (pinningEnabled && !isVideoRoom) {
|
||||
pinsOption = (
|
||||
<IconizedContextMenuOption
|
||||
|
@ -288,7 +288,7 @@ const RoomContextMenu: React.FC<IProps> = ({ room, onFinished, ...props }) => {
|
|||
);
|
||||
}
|
||||
|
||||
let widgetsOption: JSX.Element;
|
||||
let widgetsOption: JSX.Element | undefined;
|
||||
if (!isVideoRoom) {
|
||||
widgetsOption = (
|
||||
<IconizedContextMenuOption
|
||||
|
@ -306,7 +306,7 @@ const RoomContextMenu: React.FC<IProps> = ({ room, onFinished, ...props }) => {
|
|||
);
|
||||
}
|
||||
|
||||
let exportChatOption: JSX.Element;
|
||||
let exportChatOption: JSX.Element | undefined;
|
||||
if (!isVideoRoom) {
|
||||
exportChatOption = (
|
||||
<IconizedContextMenuOption
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue