Apply strictNullChecks to src/components/views/location/* (#10249

* strict fixes

* accessiblebutton without onClick explicit

* strict fix for UserMenu BaseAvatar
This commit is contained in:
Kerry 2023-02-28 21:55:59 +13:00 committed by GitHub
parent 6de8d85f7e
commit dd6fc124d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 46 additions and 31 deletions

View file

@ -15,6 +15,7 @@ limitations under the License.
*/
import { MatrixClient } from "matrix-js-sdk/src/client";
import { IContent } from "matrix-js-sdk/src/matrix";
import { MatrixError } from "matrix-js-sdk/src/http-api";
import { makeLocationContent, makeBeaconInfoContent } from "matrix-js-sdk/src/content-helpers";
import { logger } from "matrix-js-sdk/src/logger";
@ -94,7 +95,7 @@ const getDefaultErrorParams = (
return { modalParams, errorMessage };
};
const handleShareError = (error: Error, openMenu: () => void, shareType: LocationShareType): void => {
const handleShareError = (error: unknown, openMenu: () => void, shareType: LocationShareType): void => {
const { modalParams, errorMessage } =
(error as MatrixError).errcode === "M_FORBIDDEN"
? getPermissionsErrorParams(shareType)
@ -135,9 +136,9 @@ export const shareLocation =
async ({ uri, timestamp }): Promise<void> => {
if (!uri) return;
try {
const threadId = relation?.rel_type === THREAD_RELATION_TYPE.name ? relation.event_id : null;
const threadId = (relation?.rel_type === THREAD_RELATION_TYPE.name && relation?.event_id) || null;
const assetType = shareType === LocationShareType.Pin ? LocationAssetType.Pin : LocationAssetType.Self;
const content = makeLocationContent(undefined, uri, timestamp, undefined, assetType);
const content = makeLocationContent(undefined, uri, timestamp, undefined, assetType) as IContent;
await doMaybeLocalRoomAction(
roomId,
(actualRoomId: string) => client.sendMessage(actualRoomId, threadId, content),