diff --git a/src/@types/global.d.ts b/src/@types/global.d.ts index e22dd89d137..c11e34c663d 100644 --- a/src/@types/global.d.ts +++ b/src/@types/global.d.ts @@ -163,6 +163,16 @@ declare global { interface HTMLAudioElement { type?: string; + // sinkId & setSinkId are experimental and typescript doesn't know about them + sinkId: string; + setSinkId(outputId: string): void; + } + + interface HTMLVideoElement { + type?: string; + // sinkId & setSinkId are experimental and typescript doesn't know about them + sinkId: string; + setSinkId(outputId: string): void; } interface HTMLStyleElement { diff --git a/src/DecryptionFailureTracker.ts b/src/DecryptionFailureTracker.ts index dc8fdc5739f..5db75fe0f37 100644 --- a/src/DecryptionFailureTracker.ts +++ b/src/DecryptionFailureTracker.ts @@ -94,9 +94,9 @@ export class DecryptionFailureTracker { // localStorage.setItem('mx-decryption-failure-event-id-hashes', JSON.stringify(this.trackedEventHashMap)); // } - public eventDecrypted(e: MatrixEvent, err: MatrixError | Error): void { + public eventDecrypted(e: MatrixEvent, err: MatrixError): void { if (err) { - this.addDecryptionFailure(new DecryptionFailure(e.getId(), err.code)); + this.addDecryptionFailure(new DecryptionFailure(e.getId(), err.errcode)); } else { // Could be an event in the failures, remove it this.removeDecryptionFailuresForEvent(e); diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index bfdbacef7a0..a3848af83a8 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -15,7 +15,8 @@ limitations under the License. */ import React, { ComponentType, createRef } from 'react'; -import { createClient } from "matrix-js-sdk/src/matrix"; +import { createClient } from 'matrix-js-sdk/src/matrix'; +import { MatrixError } from 'matrix-js-sdk/src/http-api'; import { InvalidStoreError } from "matrix-js-sdk/src/errors"; import { MatrixEvent } from "matrix-js-sdk/src/models/event"; import { Error as ErrorEvent } from "matrix-analytics-events/types/typescript/Error"; @@ -233,7 +234,7 @@ interface IState { // When showing Modal dialogs we need to set aria-hidden on the root app element // and disable it when there are no dialogs hideToSRUsers: boolean; - syncError?: Error; + syncError?: MatrixError; resizeNotifier: ResizeNotifier; serverConfig?: ValidatedServerConfig; ready: boolean; diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index 2f1ee3400e9..65966a05e41 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -33,6 +33,7 @@ import { EventType } from 'matrix-js-sdk/src/@types/event'; import { RoomState } from 'matrix-js-sdk/src/models/room-state'; import { CallState, CallType, MatrixCall } from "matrix-js-sdk/src/webrtc/call"; import { throttle } from "lodash"; +import { MatrixError } from 'matrix-js-sdk/src/http-api'; import shouldHideEvent from '../../shouldHideEvent'; import { _t } from '../../languageHandler'; @@ -164,7 +165,7 @@ export interface IRoomState { // error object, as from the matrix client/server API // If we failed to load information about the room, // store the error here. - roomLoadError?: Error; + roomLoadError?: MatrixError; // Have we sent a request to join the room that we're waiting to complete? joining: boolean; // this is true if we are fully scrolled-down, and are looking at diff --git a/src/components/structures/auth/Login.tsx b/src/components/structures/auth/Login.tsx index 4b849e1d03d..1d963a22295 100644 --- a/src/components/structures/auth/Login.tsx +++ b/src/components/structures/auth/Login.tsx @@ -454,7 +454,7 @@ export default class LoginComponent extends React.PureComponent let errorText: ReactNode = _t("There was a problem communicating with the homeserver, " + "please try again later.") + (errCode ? " (" + errCode + ")" : ""); - if (err.cors === 'rejected') { + if (err["cors"] === 'rejected') { // browser-request specific error field if (window.location.protocol === 'https:' && (this.props.serverConfig.hsUrl.startsWith("http:") || !this.props.serverConfig.hsUrl.startsWith("http")) diff --git a/src/stores/CommunityPrototypeStore.ts b/src/stores/CommunityPrototypeStore.ts index 04f7eb29c43..83473298ba3 100644 --- a/src/stores/CommunityPrototypeStore.ts +++ b/src/stores/CommunityPrototypeStore.ts @@ -18,6 +18,7 @@ import { Room } from "matrix-js-sdk/src/models/room"; import * as utils from "matrix-js-sdk/src/utils"; import { isNullOrUndefined } from "matrix-js-sdk/src/utils"; import { logger } from "matrix-js-sdk/src/logger"; +import { Method } from "matrix-js-sdk/src/http-api"; import { AsyncStoreWithClient } from "./AsyncStoreWithClient"; import defaultDispatcher from "../dispatcher/dispatcher"; @@ -131,7 +132,7 @@ export class CommunityPrototypeStore extends AsyncStoreWithClient { try { const path = utils.encodeUri("/rooms/$roomId/group_info", { $roomId: room.roomId }); const profile = await this.matrixClient.http.authedRequest( - undefined, "GET", path, + undefined, Method.Get, path, undefined, undefined, { prefix: "/_matrix/client/unstable/im.vector.custom" }); // we use global account data because per-room account data on invites is unreliable diff --git a/src/stores/RoomViewStore.tsx b/src/stores/RoomViewStore.tsx index f54f98fdb20..3f54435205c 100644 --- a/src/stores/RoomViewStore.tsx +++ b/src/stores/RoomViewStore.tsx @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import React from "react"; +import React, { ReactNode } from "react"; import { Store } from 'flux/utils'; import { MatrixError } from "matrix-js-sdk/src/http-api"; import { logger } from "matrix-js-sdk/src/logger"; @@ -317,8 +317,8 @@ class RoomViewStore extends Store { } } - public showJoinRoomError(err: Error | MatrixError, roomId: string) { - let msg = err.message ? err.message : JSON.stringify(err); + public showJoinRoomError(err: MatrixError, roomId: string) { + let msg: ReactNode = err.message ? err.message : JSON.stringify(err); logger.log("Failed to join room:", msg); if (err.name === "ConnectionError") { diff --git a/src/utils/ErrorUtils.tsx b/src/utils/ErrorUtils.tsx index 4253564ffdf..52c9c470f85 100644 --- a/src/utils/ErrorUtils.tsx +++ b/src/utils/ErrorUtils.tsx @@ -57,7 +57,7 @@ export function messageForResourceLimitError( } } -export function messageForSyncError(err: MatrixError | Error): ReactNode { +export function messageForSyncError(err: MatrixError): ReactNode { if (err.errcode === 'M_RESOURCE_LIMIT_EXCEEDED') { const limitError = messageForResourceLimitError( err.data.limit_type,