mirror of https://github.com/vector-im/riot-web
Improve typing (#7349)
parent
b2548f05a8
commit
7033f8696a
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -454,7 +454,7 @@ export default class LoginComponent extends React.PureComponent<IProps, IState>
|
|||
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"))
|
||||
|
|
|
@ -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<IState> {
|
|||
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
|
||||
|
|
|
@ -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<ActionPayload> {
|
|||
}
|
||||
}
|
||||
|
||||
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") {
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue