Conform more of the codebase to strictNullChecks (#10842)

This commit is contained in:
Michael Telatynski 2023-05-11 09:56:56 +01:00 committed by GitHub
parent 5eea2c8b02
commit 82e32035fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 126 additions and 93 deletions

View file

@ -32,7 +32,7 @@ export interface IBodyProps {
highlightLink?: string;
/* callback called when dynamic content in events are loaded */
onHeightChanged: () => void;
onHeightChanged?: () => void;
showUrlPreview?: boolean;
forExport?: boolean;
@ -40,7 +40,7 @@ export interface IBodyProps {
replacingEventId?: string;
editState?: EditorStateTransfer;
onMessageAllowed: () => void; // TODO: Docs
permalinkCreator: RoomPermalinkCreator;
permalinkCreator?: RoomPermalinkCreator;
mediaEventHelper: MediaEventHelper;
/*

View file

@ -174,7 +174,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
private onImageLoad = (): void => {
this.clearBlurhashTimeout();
this.props.onHeightChanged();
this.props.onHeightChanged?.();
let loadedImageDimensions: IState["loadedImageDimensions"];

View file

@ -154,7 +154,7 @@ export default class MVideoBody extends React.PureComponent<IBodyProps, IState>
decryptedThumbnailUrl: thumbnailUrl,
decryptedBlob: await this.props.mediaEventHelper.sourceBlob.value,
});
this.props.onHeightChanged();
this.props.onHeightChanged?.();
} else {
logger.log("NOT preloading video");
const content = this.props.mxEvent.getContent<IMediaEventContent>();
@ -216,7 +216,7 @@ export default class MVideoBody extends React.PureComponent<IBodyProps, IState>
this.videoRef.current.play();
},
);
this.props.onHeightChanged();
this.props.onHeightChanged?.();
};
protected get showFileBody(): boolean {

View file

@ -173,7 +173,7 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
// By expanding/collapsing we changed
// the height, therefore we call this
this.props.onHeightChanged();
this.props.onHeightChanged?.();
};
div.appendChild(button);