diff --git a/src/components/views/location/Map.tsx b/src/components/views/location/Map.tsx index a6376039db..34b9d4f104 100644 --- a/src/components/views/location/Map.tsx +++ b/src/components/views/location/Map.tsx @@ -40,12 +40,12 @@ const useMapWithStyle = ({ }: { id: string; centerGeoUri?: string; - onError(error: Error): void; + onError?(error: Error): void; interactive?: boolean; bounds?: Bounds; - allowGeolocate: boolean; + allowGeolocate?: boolean; }): { - map: maplibregl.Map; + map: maplibregl.Map | undefined; bodyId: string; } => { const bodyId = `mx_Map_${id}`; @@ -122,7 +122,7 @@ const onGeolocateError = (e: GeolocationPositionError): void => { logger.error("Could not fetch location", e); Modal.createDialog(ErrorDialog, { title: _t("Could not fetch location"), - description: positionFailureMessage(e.code), + description: positionFailureMessage(e.code) ?? "", }); }; diff --git a/src/utils/location/positionFailureMessage.ts b/src/utils/location/positionFailureMessage.ts index a1e2711208..8114ee9627 100644 --- a/src/utils/location/positionFailureMessage.ts +++ b/src/utils/location/positionFailureMessage.ts @@ -17,7 +17,7 @@ limitations under the License. import { _t } from "../../languageHandler"; import SdkConfig from "../../SdkConfig"; -export const positionFailureMessage = (code: number): string => { +export const positionFailureMessage = (code: number): string | undefined => { const brand = SdkConfig.get().brand; switch (code) { case 1: