Fix more type definitions
parent
f929d2ee5f
commit
02e72d8b04
|
@ -20,19 +20,19 @@ limitations under the License.
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { _t } from '../languageHandler';
|
import { _t } from '../languageHandler';
|
||||||
import AutocompleteProvider from './AutocompleteProvider';
|
import AutocompleteProvider from './AutocompleteProvider';
|
||||||
import {PillCompletion} from './Components';
|
import { PillCompletion } from './Components';
|
||||||
import * as sdk from '../index';
|
import * as sdk from '../index';
|
||||||
import QueryMatcher from './QueryMatcher';
|
import QueryMatcher from './QueryMatcher';
|
||||||
import {sortBy} from 'lodash';
|
import { sortBy } from 'lodash';
|
||||||
import {MatrixClientPeg} from '../MatrixClientPeg';
|
import { MatrixClientPeg } from '../MatrixClientPeg';
|
||||||
|
|
||||||
import MatrixEvent from "matrix-js-sdk/src/models/event";
|
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||||
import Room from "matrix-js-sdk/src/models/room";
|
import { Room } from "matrix-js-sdk/src/models/room";
|
||||||
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
||||||
import RoomState from "matrix-js-sdk/src/models/room-state";
|
import { RoomState } from "matrix-js-sdk/src/models/room-state";
|
||||||
import EventTimeline from "matrix-js-sdk/src/models/event-timeline";
|
import { EventTimeline } from "matrix-js-sdk/src/models/event-timeline";
|
||||||
import {makeUserPermalink} from "../utils/permalinks/Permalinks";
|
import { makeUserPermalink } from "../utils/permalinks/Permalinks";
|
||||||
import {ICompletion, ISelectionRange} from "./Autocompleter";
|
import { ICompletion, ISelectionRange } from "./Autocompleter";
|
||||||
|
|
||||||
const USER_REGEX = /\B@\S*/g;
|
const USER_REGEX = /\B@\S*/g;
|
||||||
|
|
||||||
|
|
|
@ -525,11 +525,11 @@ class RoomStateExplorer extends React.PureComponent<IExplorerProps, IRoomStateEx
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IAccountDataExplorerState {
|
interface IAccountDataExplorerState {
|
||||||
|
[inputId: string]: boolean | string | any;
|
||||||
isRoomAccountData: boolean;
|
isRoomAccountData: boolean;
|
||||||
event?: MatrixEvent;
|
event?: MatrixEvent;
|
||||||
editing: boolean;
|
editing: boolean;
|
||||||
queryEventType: string;
|
queryEventType: string;
|
||||||
[inputId: string]: boolean | string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class AccountDataExplorer extends React.PureComponent<IExplorerProps, IAccountDataExplorerState> {
|
class AccountDataExplorer extends React.PureComponent<IExplorerProps, IAccountDataExplorerState> {
|
||||||
|
|
|
@ -24,7 +24,7 @@ import { _t } from '../../../languageHandler';
|
||||||
import { formatCommaSeparatedList } from '../../../utils/FormattingUtils';
|
import { formatCommaSeparatedList } from '../../../utils/FormattingUtils';
|
||||||
import { isValid3pidInvite } from "../../../RoomInvite";
|
import { isValid3pidInvite } from "../../../RoomInvite";
|
||||||
import EventListSummary from "./EventListSummary";
|
import EventListSummary from "./EventListSummary";
|
||||||
import {replaceableComponent} from "../../../utils/replaceableComponent";
|
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
// An array of member events to summarise
|
// An array of member events to summarise
|
||||||
|
@ -303,7 +303,7 @@ export default class MemberEventListSummary extends React.Component<IProps> {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static getTransitionSequence(events: MatrixEvent[]) {
|
private static getTransitionSequence(events: IUserEvents[]) {
|
||||||
return events.map(MemberEventListSummary.getTransition);
|
return events.map(MemberEventListSummary.getTransition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ export default class MemberEventListSummary extends React.Component<IProps> {
|
||||||
* @returns {string?} the transition type given to this event. This defaults to `null`
|
* @returns {string?} the transition type given to this event. This defaults to `null`
|
||||||
* if a transition is not recognised.
|
* if a transition is not recognised.
|
||||||
*/
|
*/
|
||||||
private static getTransition(e: MatrixEvent): TransitionType {
|
private static getTransition(e: IUserEvents): TransitionType {
|
||||||
if (e.mxEvent.getType() === 'm.room.third_party_invite') {
|
if (e.mxEvent.getType() === 'm.room.third_party_invite') {
|
||||||
// Handle 3pid invites the same as invites so they get bundled together
|
// Handle 3pid invites the same as invites so they get bundled together
|
||||||
if (!isValid3pidInvite(e.mxEvent)) {
|
if (!isValid3pidInvite(e.mxEvent)) {
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Flair from '../elements/Flair.js';
|
import Flair from '../elements/Flair.js';
|
||||||
import FlairStore from '../../../stores/FlairStore';
|
import FlairStore from '../../../stores/FlairStore';
|
||||||
import {getUserNameColorClass} from '../../../utils/FormattingUtils';
|
import { getUserNameColorClass } from '../../../utils/FormattingUtils';
|
||||||
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
||||||
import {replaceableComponent} from "../../../utils/replaceableComponent";
|
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||||
import MatrixEvent from "matrix-js-sdk/src/models/event";
|
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
mxEvent: MatrixEvent;
|
mxEvent: MatrixEvent;
|
||||||
|
|
|
@ -376,7 +376,7 @@ export default class EventTile extends React.Component<IProps, IState> {
|
||||||
EventType.RoomMessage,
|
EventType.RoomMessage,
|
||||||
EventType.RoomMessageEncrypted,
|
EventType.RoomMessageEncrypted,
|
||||||
];
|
];
|
||||||
if (!simpleSendableEvents.includes(this.props.mxEvent.getType())) return false;
|
if (!simpleSendableEvents.includes(this.props.mxEvent.getType() as EventType)) return false;
|
||||||
|
|
||||||
// Default case
|
// Default case
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -44,7 +44,7 @@ export default class BridgeSettingsTab extends React.Component<IProps> {
|
||||||
return <BridgeTile key={event.getId()} room={room} ev={event} />;
|
return <BridgeTile key={event.getId()} room={room} ev={event} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
static getBridgeStateEvents(roomId: string) {
|
static getBridgeStateEvents(roomId: string): MatrixEvent[] {
|
||||||
const client = MatrixClientPeg.get();
|
const client = MatrixClientPeg.get();
|
||||||
const roomState = client.getRoom(roomId).currentState;
|
const roomState = client.getRoom(roomId).currentState;
|
||||||
|
|
||||||
|
|
|
@ -300,7 +300,7 @@ export default class EventIndex extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private eventToJson(ev: MatrixEvent) {
|
private eventToJson(ev: MatrixEvent) {
|
||||||
const jsonEvent = ev.toJSON();
|
const jsonEvent: any = ev.toJSON();
|
||||||
const e = ev.isEncrypted() ? jsonEvent.decrypted : jsonEvent;
|
const e = ev.isEncrypted() ? jsonEvent.decrypted : jsonEvent;
|
||||||
|
|
||||||
if (ev.isEncrypted()) {
|
if (ev.isEncrypted()) {
|
||||||
|
|
|
@ -16,8 +16,8 @@ limitations under the License.
|
||||||
|
|
||||||
import EventEmitter from 'events';
|
import EventEmitter from 'events';
|
||||||
import { IWidget } from 'matrix-widget-api';
|
import { IWidget } from 'matrix-widget-api';
|
||||||
import MatrixEvent from "matrix-js-sdk/src/models/event";
|
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||||
import {WidgetType} from "../widgets/WidgetType";
|
import { WidgetType } from "../widgets/WidgetType";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acts as a place to get & set widget state, storing local echo state and
|
* Acts as a place to get & set widget state, storing local echo state and
|
||||||
|
|
|
@ -51,7 +51,7 @@ import ThemeWatcher from "../../settings/watchers/ThemeWatcher";
|
||||||
import {getCustomTheme} from "../../theme";
|
import {getCustomTheme} from "../../theme";
|
||||||
import CountlyAnalytics from "../../CountlyAnalytics";
|
import CountlyAnalytics from "../../CountlyAnalytics";
|
||||||
import { ElementWidgetCapabilities } from "./ElementWidgetCapabilities";
|
import { ElementWidgetCapabilities } from "./ElementWidgetCapabilities";
|
||||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
import { MatrixEvent, IEvent } from "matrix-js-sdk/src/models/event";
|
||||||
import { ELEMENT_CLIENT_ID } from "../../identifiers";
|
import { ELEMENT_CLIENT_ID } from "../../identifiers";
|
||||||
import { getUserLanguage } from "../../languageHandler";
|
import { getUserLanguage } from "../../languageHandler";
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ export class StopGapWidget extends EventEmitter {
|
||||||
private feedEvent(ev: MatrixEvent) {
|
private feedEvent(ev: MatrixEvent) {
|
||||||
if (!this.messaging) return;
|
if (!this.messaging) return;
|
||||||
|
|
||||||
const raw = ev.event;
|
const raw = ev.event as IEvent;
|
||||||
this.messaging.feedEvent(raw).catch(e => {
|
this.messaging.feedEvent(raw).catch(e => {
|
||||||
console.error("Error sending event to widget: ", e);
|
console.error("Error sending event to widget: ", e);
|
||||||
});
|
});
|
||||||
|
|
|
@ -145,7 +145,7 @@ export class StopGapWidgetDriver extends WidgetDriver {
|
||||||
return {roomId, eventId: r.event_id};
|
return {roomId, eventId: r.event_id};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async readRoomEvents(eventType: string, msgtype: string | undefined, limit: number): Promise<MatrixEvent[]> {
|
public async readRoomEvents(eventType: string, msgtype: string | undefined, limit: number): Promise<object[]> {
|
||||||
limit = limit > 0 ? Math.min(limit, 25) : 25; // arbitrary choice
|
limit = limit > 0 ? Math.min(limit, 25) : 25; // arbitrary choice
|
||||||
|
|
||||||
const client = MatrixClientPeg.get();
|
const client = MatrixClientPeg.get();
|
||||||
|
@ -167,9 +167,7 @@ export class StopGapWidgetDriver extends WidgetDriver {
|
||||||
return results.map(e => e.event);
|
return results.map(e => e.event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async readStateEvents(
|
public async readStateEvents(eventType: string, stateKey: string | undefined, limit: number): Promise<object[]> {
|
||||||
eventType: string, stateKey: string | undefined, limit: number,
|
|
||||||
): Promise<MatrixEvent[]> {
|
|
||||||
limit = limit > 0 ? Math.min(limit, 100) : 100; // arbitrary choice
|
limit = limit > 0 ? Math.min(limit, 100) : 100; // arbitrary choice
|
||||||
|
|
||||||
const client = MatrixClientPeg.get();
|
const client = MatrixClientPeg.get();
|
||||||
|
|
|
@ -14,11 +14,12 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {MatrixClientPeg} from '../MatrixClientPeg';
|
import { uniq } from "lodash";
|
||||||
import {uniq} from "lodash";
|
import { Room } from "matrix-js-sdk/src/models/room";
|
||||||
import {Room} from "matrix-js-sdk/src/models/room";
|
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||||
import {Event} from "matrix-js-sdk/src/models/event";
|
import { MatrixClient } from "matrix-js-sdk/src/client";
|
||||||
import {MatrixClient} from "matrix-js-sdk/src/client";
|
|
||||||
|
import { MatrixClientPeg } from '../MatrixClientPeg';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class that takes a Matrix Client and flips the m.direct map
|
* Class that takes a Matrix Client and flips the m.direct map
|
||||||
|
@ -35,7 +36,7 @@ export default class DMRoomMap {
|
||||||
private roomToUser: {[key: string]: string} = null;
|
private roomToUser: {[key: string]: string} = null;
|
||||||
private userToRooms: {[key: string]: string[]} = null;
|
private userToRooms: {[key: string]: string[]} = null;
|
||||||
private hasSentOutPatchDirectAccountDataPatch: boolean;
|
private hasSentOutPatchDirectAccountDataPatch: boolean;
|
||||||
private mDirectEvent: Event;
|
private mDirectEvent: MatrixEvent;
|
||||||
|
|
||||||
constructor(matrixClient) {
|
constructor(matrixClient) {
|
||||||
this.matrixClient = matrixClient;
|
this.matrixClient = matrixClient;
|
||||||
|
|
Loading…
Reference in New Issue