Conform more of the codebase to strictNullChecks (#10358

* Conform more of the codebase to `strictNullChecks`

* Fix types

* Iterate

* Iterate
This commit is contained in:
Michael Telatynski 2023-03-13 15:07:20 +00:00 committed by GitHub
parent 41d88ad6ae
commit 503df62191
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
76 changed files with 323 additions and 327 deletions

View file

@ -44,7 +44,7 @@ export default class LinkPreviewWidget extends React.Component<IProps> {
ev.preventDefault();
let src = p["og:image"];
if (src && src.startsWith("mxc://")) {
if (src?.startsWith("mxc://")) {
src = mediaFromMxc(src).srcHttp;
}
@ -68,7 +68,7 @@ export default class LinkPreviewWidget extends React.Component<IProps> {
};
}
Modal.createDialog(ImageView, params, "mx_Dialog_lightbox", null, true);
Modal.createDialog(ImageView, params, "mx_Dialog_lightbox", undefined, true);
};
public render(): React.ReactNode {
@ -78,7 +78,7 @@ export default class LinkPreviewWidget extends React.Component<IProps> {
}
// FIXME: do we want to factor out all image displaying between this and MImageBody - especially for lightboxing?
let image = p["og:image"];
let image: string | null = p["og:image"] ?? null;
if (!SettingsStore.getValue("showImages")) {
image = null; // Don't render a button to show the image, just hide it outright
}
@ -99,7 +99,7 @@ export default class LinkPreviewWidget extends React.Component<IProps> {
);
}
let img;
let img: JSX.Element | undefined;
if (image) {
img = (
<div className="mx_LinkPreviewWidget_image" style={{ height: thumbHeight }}>