Improve typing (#7349)

This commit is contained in:
Michael Telatynski 2021-12-14 15:34:54 +00:00 committed by GitHub
parent b2548f05a8
commit 7033f8696a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 24 additions and 11 deletions

View file

@ -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;

View file

@ -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

View file

@ -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"))