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

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

View file

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