Conform more code to strictNullChecks (#10383

* Update matrix-widget-api

* Conform more code to `strictNullChecks`

* Iterate
This commit is contained in:
Michael Telatynski 2023-03-16 10:35:17 +00:00 committed by GitHub
parent aae9dfbb7d
commit 9c816bb720
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 112 additions and 93 deletions

View file

@ -135,7 +135,7 @@ export default abstract class Exporter {
let limit: number;
switch (this.exportType) {
case ExportType.LastNMessages:
limit = this.exportOptions.numberOfMessages;
limit = this.exportOptions.numberOfMessages!;
break;
case ExportType.Timeline:
limit = 40;
@ -221,11 +221,11 @@ export default abstract class Exporter {
return events;
}
protected async getMediaBlob(event: MatrixEvent): Promise<Blob> {
let blob: Blob;
protected async getMediaBlob(event: MatrixEvent): Promise<Blob | undefined> {
let blob: Blob | undefined;
try {
const isEncrypted = event.isEncrypted();
const content: IMediaEventContent = event.getContent();
const content = event.getContent<IMediaEventContent>();
const shouldDecrypt = isEncrypted && content.hasOwnProperty("file") && event.getType() !== "m.sticker";
if (shouldDecrypt) {
blob = await decryptFile(content.file);