Improve strictNullChecks support in right_panel (#10415)

This commit is contained in:
Andy Balaam 2023-03-22 12:15:26 +00:00 committed by GitHub
parent 853b3f822d
commit ba36d2cc01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 63 additions and 52 deletions

View file

@ -87,7 +87,7 @@ export interface IDevice extends DeviceInfo {
export const disambiguateDevices = (devices: IDevice[]): void => {
const names = Object.create(null);
for (let i = 0; i < devices.length; i++) {
const name = devices[i].getDisplayName();
const name = devices[i].getDisplayName() ?? "";
const indexList = names[name] || [];
indexList.push(i);
names[name] = indexList;
@ -595,7 +595,7 @@ export const RoomKickButton = ({
member,
startUpdating,
stopUpdating,
}: Omit<IBaseRoomProps, "powerLevels">): JSX.Element => {
}: Omit<IBaseRoomProps, "powerLevels">): JSX.Element | null => {
const cli = useContext(MatrixClientContext);
// check if user can be kicked/disinvited
@ -1611,7 +1611,7 @@ const UserInfo: React.FC<IProps> = ({ user, room, onClose, phase = RightPanelPha
const member = useMemo(() => (room ? room.getMember(user.userId) || user : user), [room, user]);
const isRoomEncrypted = useIsEncrypted(cli, room);
const devices = useDevices(user.userId);
const devices = useDevices(user.userId) ?? [];
let e2eStatus: E2EStatus | undefined;
if (isRoomEncrypted && devices) {