mirror of https://github.com/vector-im/riot-web
Upgrade target to es2022 (#12852)
* Upgrade target to es2021 Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Upgrade to es2022 Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix babel config Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix React contexts Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix types Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix React state Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>dbkr/sss
parent
9cd0c247a2
commit
c1d4199b02
|
@ -10,15 +10,15 @@ module.exports = {
|
|||
"last 2 Safari versions",
|
||||
"last 2 Edge versions",
|
||||
],
|
||||
include: ["@babel/plugin-transform-class-properties"],
|
||||
},
|
||||
],
|
||||
"@babel/preset-typescript",
|
||||
["@babel/preset-typescript", { allowDeclareFields: true }],
|
||||
"@babel/preset-react",
|
||||
],
|
||||
plugins: [
|
||||
"@babel/plugin-proposal-export-default-from",
|
||||
"@babel/plugin-transform-numeric-separator",
|
||||
"@babel/plugin-transform-class-properties",
|
||||
"@babel/plugin-transform-object-rest-spread",
|
||||
"@babel/plugin-syntax-dynamic-import",
|
||||
"@babel/plugin-transform-runtime",
|
||||
|
|
|
@ -29,7 +29,6 @@ const dendriteConfigFile = "dendrite.yaml";
|
|||
|
||||
// Surprisingly, Dendrite implements the same register user Admin API Synapse, so we can just extend it
|
||||
export class Dendrite extends Synapse implements Homeserver, HomeserverInstance {
|
||||
public config: HomeserverConfig & { serverId: string };
|
||||
protected image = "matrixdotorg/dendrite-monolith:main";
|
||||
protected entrypoint = "/usr/bin/dendrite";
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2018",
|
||||
"target": "es2022",
|
||||
"jsx": "react",
|
||||
"lib": ["ESNext", "es2021", "dom", "dom.iterable"],
|
||||
"lib": ["ESNext", "es2022", "dom", "dom.iterable"],
|
||||
"resolveJsonModule": true,
|
||||
"esModuleInterop": true,
|
||||
"moduleResolution": "node",
|
||||
|
|
|
@ -144,69 +144,14 @@ declare global {
|
|||
usageDetails?: { [key: string]: number };
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas
|
||||
interface OffscreenCanvas {
|
||||
convertToBlob(opts?: { type?: string; quality?: number }): Promise<Blob>;
|
||||
}
|
||||
|
||||
interface HTMLAudioElement {
|
||||
type?: string;
|
||||
}
|
||||
|
||||
interface HTMLVideoElement {
|
||||
type?: string;
|
||||
}
|
||||
|
||||
// Add Chrome-specific `instant` ScrollBehaviour
|
||||
type _ScrollBehavior = ScrollBehavior | "instant";
|
||||
|
||||
interface _ScrollOptions {
|
||||
behavior?: _ScrollBehavior;
|
||||
}
|
||||
|
||||
interface _ScrollIntoViewOptions extends _ScrollOptions {
|
||||
block?: ScrollLogicalPosition;
|
||||
inline?: ScrollLogicalPosition;
|
||||
}
|
||||
|
||||
interface Element {
|
||||
// Safari & IE11 only have this prefixed: we used prefixed versions
|
||||
// previously so let's continue to support them for now
|
||||
webkitRequestFullScreen(options?: FullscreenOptions): Promise<void>;
|
||||
msRequestFullscreen(options?: FullscreenOptions): Promise<void>;
|
||||
scrollIntoView(arg?: boolean | _ScrollIntoViewOptions): void;
|
||||
// scrollIntoView(arg?: boolean | _ScrollIntoViewOptions): void;
|
||||
}
|
||||
|
||||
interface Error {
|
||||
// Standard
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause
|
||||
cause?: unknown;
|
||||
|
||||
// Non-standard
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/fileName
|
||||
fileName?: string;
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/lineNumber
|
||||
lineNumber?: number;
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/columnNumber
|
||||
columnNumber?: number;
|
||||
}
|
||||
|
||||
// We can remove these pieces if we ever update to `target: "es2022"` in our
|
||||
// TypeScript config which supports the new `cause` property, see
|
||||
// https://github.com/vector-im/element-web/issues/24913
|
||||
interface ErrorOptions {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause
|
||||
cause?: unknown;
|
||||
}
|
||||
|
||||
interface ErrorConstructor {
|
||||
new (message?: string, options?: ErrorOptions): Error;
|
||||
(message?: string, options?: ErrorOptions): Error;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-var
|
||||
var Error: ErrorConstructor;
|
||||
|
||||
// https://github.com/microsoft/TypeScript/issues/28308#issuecomment-650802278
|
||||
interface AudioWorkletProcessor {
|
||||
readonly port: MessagePort;
|
||||
|
|
|
@ -45,7 +45,7 @@ interface IState {
|
|||
|
||||
export default class EmbeddedPage extends React.PureComponent<IProps, IState> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
private unmounted = false;
|
||||
private dispatcherRef: string | null = null;
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ interface IState {
|
|||
*/
|
||||
class FilePanel extends React.Component<IProps, IState> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
// This is used to track if a decrypted event was a live event and should be
|
||||
// added to the timeline.
|
||||
|
|
|
@ -205,7 +205,7 @@ interface IReadReceiptForUser {
|
|||
*/
|
||||
export default class MessagePanel extends React.Component<IProps, IState> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
public static defaultProps = {
|
||||
disableGrouping: false,
|
||||
|
|
|
@ -42,7 +42,7 @@ interface IState {
|
|||
*/
|
||||
export default class NotificationPanel extends React.PureComponent<IProps, IState> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
private card = React.createRef<HTMLDivElement>();
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ interface IState {
|
|||
|
||||
export default class RightPanel extends React.Component<Props, IState> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: Props, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
|
|
|
@ -97,11 +97,10 @@ interface IState {
|
|||
export default class RoomStatusBar extends React.PureComponent<IProps, IState> {
|
||||
private unmounted = false;
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
this.context = context; // XXX: workaround for lack of `declare` support on `public context!:` definition
|
||||
|
||||
this.state = {
|
||||
syncState: this.context.getSyncState(),
|
||||
|
|
|
@ -417,7 +417,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
|||
private roomViewBody = createRef<HTMLDivElement>();
|
||||
|
||||
public static contextType = SDKContext;
|
||||
public context!: React.ContextType<typeof SDKContext>;
|
||||
public declare context: React.ContextType<typeof SDKContext>;
|
||||
|
||||
public constructor(props: IRoomProps, context: React.ContextType<typeof SDKContext>) {
|
||||
super(props, context);
|
||||
|
|
|
@ -605,7 +605,7 @@ const SpaceSetupPrivateInvite: React.FC<{
|
|||
|
||||
export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
private readonly dispatcherRef: string;
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ interface IState {
|
|||
|
||||
export default class ThreadView extends React.Component<IProps, IState> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
private dispatcherRef: string | null = null;
|
||||
private readonly layoutWatcherRef: string;
|
||||
|
|
|
@ -241,7 +241,7 @@ interface IEventIndexOpts {
|
|||
*/
|
||||
class TimelinePanel extends React.Component<IProps, IState> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
// a map from room id to read marker event timestamp
|
||||
public static roomReadMarkerTsMap: Record<string, number> = {};
|
||||
|
@ -273,7 +273,6 @@ class TimelinePanel extends React.Component<IProps, IState> {
|
|||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
this.context = context;
|
||||
|
||||
debuglog("mounting");
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ const below = (rect: PartialDOMRect): MenuProps => {
|
|||
|
||||
export default class UserMenu extends React.Component<IProps, IState> {
|
||||
public static contextType = SDKContext;
|
||||
public context!: React.ContextType<typeof SDKContext>;
|
||||
public declare context: React.ContextType<typeof SDKContext>;
|
||||
|
||||
private dispatcherRef?: string;
|
||||
private themeWatcherRef?: string;
|
||||
|
@ -100,7 +100,6 @@ export default class UserMenu extends React.Component<IProps, IState> {
|
|||
public constructor(props: IProps, context: React.ContextType<typeof SDKContext>) {
|
||||
super(props, context);
|
||||
|
||||
this.context = context;
|
||||
this.state = {
|
||||
contextMenuPosition: null,
|
||||
isDarkTheme: this.isUserOnDarkTheme(),
|
||||
|
|
|
@ -41,7 +41,7 @@ interface IState {
|
|||
|
||||
export default class UserView extends React.Component<IProps, IState> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
|
|
|
@ -72,13 +72,11 @@ interface IState {
|
|||
|
||||
export default class SoftLogout extends React.Component<IProps, IState> {
|
||||
public static contextType = SDKContext;
|
||||
public context!: React.ContextType<typeof SDKContext>;
|
||||
public declare context: React.ContextType<typeof SDKContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof SDKContext>) {
|
||||
super(props, context);
|
||||
|
||||
this.context = context;
|
||||
|
||||
this.state = {
|
||||
loginView: LoginView.Loading,
|
||||
busy: false,
|
||||
|
|
|
@ -133,7 +133,7 @@ interface IState {
|
|||
|
||||
export default class MessageContextMenu extends React.Component<IProps, IState> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
private reactButtonRef = createRef<any>(); // XXX Ref to a functional component
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ interface IState {
|
|||
|
||||
export default class AppTile extends React.Component<IProps, IState> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: ContextType<typeof MatrixClientContext>;
|
||||
public declare context: ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public static defaultProps: Partial<IProps> = {
|
||||
waitForIframeLoad: true,
|
||||
|
@ -144,7 +144,6 @@ export default class AppTile extends React.Component<IProps, IState> {
|
|||
|
||||
public constructor(props: IProps, context: ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
this.context = context; // XXX: workaround for lack of `declare` support on `public context!:` definition
|
||||
|
||||
// Tiles in miniMode are floating, and therefore not docked
|
||||
if (!this.props.miniMode) {
|
||||
|
|
|
@ -81,7 +81,7 @@ export default class EventListSummary extends React.Component<
|
|||
IProps & Required<Pick<IProps, "summaryLength" | "threshold" | "avatarsMaxLength" | "layout">>
|
||||
> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
public static defaultProps = {
|
||||
summaryLength: 1,
|
||||
|
|
|
@ -32,7 +32,7 @@ interface IProps {
|
|||
|
||||
export default class PersistentApp extends React.Component<IProps> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: ContextType<typeof MatrixClientContext>;
|
||||
public declare context: ContextType<typeof MatrixClientContext>;
|
||||
private room: Room;
|
||||
|
||||
public constructor(props: IProps, context: ContextType<typeof MatrixClientContext>) {
|
||||
|
|
|
@ -73,7 +73,7 @@ interface IState {
|
|||
// be low as each event being loaded (after the first) is triggered by an explicit user action.
|
||||
export default class ReplyChain extends React.Component<IProps, IState> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
private unmounted = false;
|
||||
private room: Room;
|
||||
|
|
|
@ -41,7 +41,7 @@ interface IState {
|
|||
// Controlled form component wrapping Field for inputting a room alias scoped to a given domain
|
||||
export default class RoomAliasField extends React.PureComponent<IProps, IState> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
private fieldRef = createRef<Field>();
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ interface IState {
|
|||
|
||||
class ReactionPicker extends React.Component<IProps, IState> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
|
|
|
@ -31,7 +31,7 @@ interface IProps {
|
|||
|
||||
class Search extends React.PureComponent<IProps> {
|
||||
public static contextType = RovingTabIndexContext;
|
||||
public context!: React.ContextType<typeof RovingTabIndexContext>;
|
||||
public declare context: React.ContextType<typeof RovingTabIndexContext>;
|
||||
|
||||
private inputRef = React.createRef<HTMLInputElement>();
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ const isSharingOwnLocation = (shareType: LocationShareType): boolean =>
|
|||
|
||||
class LocationPicker extends React.Component<ILocationPickerProps, IState> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
private map?: maplibregl.Map;
|
||||
private geolocate?: maplibregl.GeolocateControl;
|
||||
private marker?: maplibregl.Marker;
|
||||
|
|
|
@ -52,7 +52,7 @@ interface IState {
|
|||
|
||||
export default class EditHistoryMessage extends React.PureComponent<IProps, IState> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
private content = createRef<HTMLDivElement>();
|
||||
private pills: Element[] = [];
|
||||
|
@ -60,7 +60,6 @@ export default class EditHistoryMessage extends React.PureComponent<IProps, ISta
|
|||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
this.context = context;
|
||||
|
||||
const cli = this.context;
|
||||
const userId = cli.getSafeUserId();
|
||||
|
|
|
@ -38,7 +38,7 @@ interface IState {
|
|||
|
||||
export default class MAudioBody extends React.PureComponent<IBodyProps, IState> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
public state: IState = {};
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ interface IState {
|
|||
|
||||
export default class MFileBody extends React.Component<IProps, IState> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
public state: IState = {};
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ interface IState {
|
|||
|
||||
export default class MImageBody extends React.Component<IBodyProps, IState> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
private unmounted = true;
|
||||
private image = createRef<HTMLImageElement>();
|
||||
|
|
|
@ -38,7 +38,7 @@ interface IState {
|
|||
|
||||
export default class MLocationBody extends React.Component<IBodyProps, IState> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
private unmounted = false;
|
||||
private mapId: string;
|
||||
|
|
|
@ -147,7 +147,7 @@ export function launchPollEditor(mxEvent: MatrixEvent, getRelationsForEvent?: Ge
|
|||
|
||||
export default class MPollBody extends React.Component<IBodyProps, IState> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
private seenEventIds: string[] = []; // Events we have already seen
|
||||
|
||||
public constructor(props: IBodyProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
|
|
|
@ -42,7 +42,7 @@ interface IState {
|
|||
|
||||
export default class MVideoBody extends React.PureComponent<IBodyProps, IState> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
private videoRef = React.createRef<HTMLVideoElement>();
|
||||
private sizeWatcher?: string;
|
||||
|
|
|
@ -261,7 +261,7 @@ interface IMessageActionBarProps {
|
|||
|
||||
export default class MessageActionBar extends React.PureComponent<IMessageActionBarProps> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
public componentDidMount(): void {
|
||||
if (this.props.mxEvent.status && this.props.mxEvent.status !== EventStatus.SENT) {
|
||||
|
|
|
@ -90,7 +90,7 @@ export default class MessageEvent extends React.Component<IProps> implements IMe
|
|||
private evTypes = new Map<string, React.ComponentType<IBodyProps>>(baseEvTypes.entries());
|
||||
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
|
|
|
@ -83,11 +83,10 @@ interface IState {
|
|||
|
||||
export default class ReactionsRow extends React.PureComponent<IProps, IState> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
this.context = context;
|
||||
|
||||
this.state = {
|
||||
myReactions: this.getMyReactions(),
|
||||
|
|
|
@ -46,7 +46,7 @@ export interface IProps {
|
|||
|
||||
export default class ReactionsRowButton extends React.PureComponent<IProps> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public onClick = (): void => {
|
||||
const { mxEvent, myReactionEvent, content } = this.props;
|
||||
|
|
|
@ -36,7 +36,7 @@ interface IProps {
|
|||
|
||||
export default class ReactionsRowButtonTooltip extends React.PureComponent<PropsWithChildren<IProps>> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public render(): React.ReactNode {
|
||||
const { content, reactionEvents, mxEvent, children } = this.props;
|
||||
|
|
|
@ -66,7 +66,7 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
|
|||
private tooltips: Element[] = [];
|
||||
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
public state = {
|
||||
links: [],
|
||||
|
|
|
@ -77,7 +77,7 @@ interface IState {
|
|||
|
||||
export default class TimelineCard extends React.Component<IProps, IState> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
private dispatcherRef?: string;
|
||||
private layoutWatcherRef?: string;
|
||||
|
|
|
@ -102,7 +102,7 @@ interface IState {
|
|||
|
||||
export default class AliasSettings extends React.Component<IProps, IState> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: ContextType<typeof MatrixClientContext>;
|
||||
public declare context: ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public static defaultProps = {
|
||||
canSetAliases: false,
|
||||
|
|
|
@ -56,7 +56,7 @@ export default class Autocomplete extends React.PureComponent<IProps, IState> {
|
|||
private containerRef = createRef<HTMLDivElement>();
|
||||
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
|
|
|
@ -129,7 +129,7 @@ interface IState {
|
|||
|
||||
class EditMessageComposer extends React.Component<IEditMessageComposerProps, IState> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
private readonly editorRef = createRef<BasicMessageComposer>();
|
||||
private readonly dispatcherRef: string;
|
||||
|
@ -138,7 +138,6 @@ class EditMessageComposer extends React.Component<IEditMessageComposerProps, ISt
|
|||
|
||||
public constructor(props: IEditMessageComposerProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
this.context = context; // otherwise React will only set it prior to render due to type def above
|
||||
|
||||
const isRestored = this.createEditorModel();
|
||||
const ev = this.props.editState.getEvent();
|
||||
|
|
|
@ -297,7 +297,7 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
|
|||
};
|
||||
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
private unmounted = false;
|
||||
|
||||
|
|
|
@ -493,7 +493,7 @@ export default class RoomHeader extends React.Component<IProps, IState> {
|
|||
};
|
||||
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
private readonly client = this.props.room.client;
|
||||
private readonly featureAskToJoinWatcher: string;
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ export default class MemberList extends React.Component<IProps, IState> {
|
|||
private mounted = false;
|
||||
|
||||
public static contextType = SDKContext;
|
||||
public context!: React.ContextType<typeof SDKContext>;
|
||||
public declare context: React.ContextType<typeof SDKContext>;
|
||||
private tiles: Map<string, MemberTile> = new Map();
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof SDKContext>) {
|
||||
|
|
|
@ -119,7 +119,7 @@ export class MessageComposer extends React.Component<IProps, IState> {
|
|||
private _voiceRecording: Optional<VoiceMessageRecording>;
|
||||
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
public static defaultProps = {
|
||||
compact: false,
|
||||
|
|
|
@ -298,7 +298,7 @@ interface IPollButtonProps {
|
|||
|
||||
class PollButton extends React.PureComponent<IPollButtonProps> {
|
||||
public static contextType = OverflowMenuContext;
|
||||
public context!: React.ContextType<typeof OverflowMenuContext>;
|
||||
public declare context: React.ContextType<typeof OverflowMenuContext>;
|
||||
|
||||
private onCreateClick = (): void => {
|
||||
this.context?.(); // close overflow menu
|
||||
|
|
|
@ -40,7 +40,7 @@ const AVATAR_SIZE = "24px";
|
|||
|
||||
export default class PinnedEventTile extends React.Component<IProps> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
private onTileClicked = (): void => {
|
||||
dis.dispatch<ViewRoomPayload>({
|
||||
|
|
|
@ -39,7 +39,7 @@ interface IProps {
|
|||
|
||||
export default class ReplyPreview extends React.Component<IProps> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
public render(): JSX.Element | null {
|
||||
if (!this.props.replyToEvent) return null;
|
||||
|
|
|
@ -432,7 +432,7 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
|
|||
private treeRef = createRef<HTMLDivElement>();
|
||||
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
|
|
|
@ -33,7 +33,7 @@ interface IState {
|
|||
|
||||
export default class RoomUpgradeWarningBar extends React.PureComponent<IProps, IState> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
|
|
|
@ -44,7 +44,7 @@ interface IProps {
|
|||
|
||||
export default class SearchResultTile extends React.Component<IProps> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
// A map of <callId, LegacyCallEventGrouper>
|
||||
private callEventGroupers = new Map<string, LegacyCallEventGrouper>();
|
||||
|
|
|
@ -254,7 +254,7 @@ interface ISendMessageComposerProps extends MatrixClientProps {
|
|||
|
||||
export class SendMessageComposer extends React.Component<ISendMessageComposerProps> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
|
||||
private readonly prepareToEncrypt?: DebouncedFunc<() => void>;
|
||||
private readonly editorRef = createRef<BasicMessageComposer>();
|
||||
|
@ -269,7 +269,6 @@ export class SendMessageComposer extends React.Component<ISendMessageComposerPro
|
|||
|
||||
public constructor(props: ISendMessageComposerProps, context: React.ContextType<typeof RoomContext>) {
|
||||
super(props, context);
|
||||
this.context = context; // otherwise React will only set it prior to render due to type def above
|
||||
|
||||
if (this.props.mxClient.isCryptoEnabled() && this.props.mxClient.isRoomEncrypted(this.props.room.roomId)) {
|
||||
this.prepareToEncrypt = throttle(
|
||||
|
|
|
@ -63,7 +63,7 @@ interface IState {
|
|||
*/
|
||||
export default class VoiceRecordComposerTile extends React.PureComponent<IProps, IState> {
|
||||
public static contextType = RoomContext;
|
||||
public context!: React.ContextType<typeof RoomContext>;
|
||||
public declare context: React.ContextType<typeof RoomContext>;
|
||||
private voiceRecordingId: string;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof RoomContext>) {
|
||||
|
|
|
@ -36,7 +36,7 @@ interface IProps {
|
|||
|
||||
export default class BridgeSettingsTab extends React.Component<IProps> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
private renderBridgeCard(event: MatrixEvent, room: Room | null): ReactNode {
|
||||
const content = event.getContent();
|
||||
|
|
|
@ -42,7 +42,7 @@ interface IState {
|
|||
|
||||
export default class GeneralRoomSettingsTab extends React.Component<IProps, IState> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: ContextType<typeof MatrixClientContext>;
|
||||
public declare context: ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps, context: ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
|
|
|
@ -50,7 +50,7 @@ export default class NotificationsSettingsTab extends React.Component<IProps, IS
|
|||
private soundUpload = createRef<HTMLInputElement>();
|
||||
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
|
|
|
@ -89,7 +89,7 @@ interface IBannedUserProps {
|
|||
|
||||
export class BannedUser extends React.Component<IBannedUserProps> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
private onUnbanClick = (): void => {
|
||||
this.context.unban(this.props.member.roomId, this.props.member.userId).catch((err) => {
|
||||
|
@ -137,7 +137,7 @@ interface IProps {
|
|||
|
||||
export default class RolesRoomSettingsTab extends React.Component<IProps> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public componentDidMount(): void {
|
||||
this.context.on(RoomStateEvent.Update, this.onRoomStateUpdate);
|
||||
|
|
|
@ -67,7 +67,7 @@ interface IState {
|
|||
|
||||
export default class SecurityRoomSettingsTab extends React.Component<IProps, IState> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
|
|
|
@ -40,7 +40,7 @@ interface IState {
|
|||
|
||||
export default class HelpUserSettingsTab extends React.Component<IProps, IState> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: IProps, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
|
|
|
@ -59,7 +59,7 @@ const mapDeviceKindToHandlerValue = (deviceKind: MediaDeviceKindEnum): string |
|
|||
|
||||
export default class VoiceUserSettingsTab extends React.Component<{}, IState> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public constructor(props: {}, context: React.ContextType<typeof MatrixClientContext>) {
|
||||
super(props, context);
|
||||
|
|
|
@ -126,8 +126,8 @@ interface CallEventHandlerMap {
|
|||
* A group call accessed through a widget.
|
||||
*/
|
||||
export abstract class Call extends TypedEventEmitter<CallEvent, CallEventHandlerMap> {
|
||||
protected readonly widgetUid = WidgetUtils.getWidgetUid(this.widget);
|
||||
protected readonly room = this.client.getRoom(this.roomId)!;
|
||||
protected readonly widgetUid: string;
|
||||
protected readonly room: Room;
|
||||
|
||||
/**
|
||||
* The time after which device member state should be considered expired.
|
||||
|
@ -184,6 +184,8 @@ export abstract class Call extends TypedEventEmitter<CallEvent, CallEventHandler
|
|||
protected readonly client: MatrixClient,
|
||||
) {
|
||||
super();
|
||||
this.widgetUid = WidgetUtils.getWidgetUid(this.widget);
|
||||
this.room = this.client.getRoom(this.roomId)!;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,7 +26,7 @@ import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
|||
|
||||
export class PollStartEventPreview implements IPreview {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
public declare context: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
public getTextFor(event: MatrixEvent, tagId?: TagID, isThread?: boolean): string | null {
|
||||
let eventContent = event.getContent();
|
||||
|
|
|
@ -20,7 +20,7 @@ import { logger } from "matrix-js-sdk/src/logger";
|
|||
import { _t } from "../languageHandler";
|
||||
import SdkConfig from "../SdkConfig";
|
||||
|
||||
const subtleCrypto = window.crypto.subtle || window.crypto.webkitSubtle;
|
||||
const subtleCrypto = window.crypto.subtle;
|
||||
|
||||
/**
|
||||
* Make an Error object which has a friendlyText property which is already
|
||||
|
|
|
@ -35,18 +35,18 @@ import {
|
|||
* replace individual stores. This is useful for tests which need to mock out stores.
|
||||
*/
|
||||
export class TestSdkContext extends SdkContextClass {
|
||||
public _RightPanelStore?: RightPanelStore;
|
||||
public _RoomNotificationStateStore?: RoomNotificationStateStore;
|
||||
public _RoomViewStore?: RoomViewStore;
|
||||
public _WidgetPermissionStore?: WidgetPermissionStore;
|
||||
public _WidgetLayoutStore?: WidgetLayoutStore;
|
||||
public _WidgetStore?: WidgetStore;
|
||||
public _PosthogAnalytics?: PosthogAnalytics;
|
||||
public _SlidingSyncManager?: SlidingSyncManager;
|
||||
public _SpaceStore?: SpaceStoreClass;
|
||||
public _VoiceBroadcastRecordingsStore?: VoiceBroadcastRecordingsStore;
|
||||
public _VoiceBroadcastPreRecordingStore?: VoiceBroadcastPreRecordingStore;
|
||||
public _VoiceBroadcastPlaybacksStore?: VoiceBroadcastPlaybacksStore;
|
||||
public declare _RightPanelStore?: RightPanelStore;
|
||||
public declare _RoomNotificationStateStore?: RoomNotificationStateStore;
|
||||
public declare _RoomViewStore?: RoomViewStore;
|
||||
public declare _WidgetPermissionStore?: WidgetPermissionStore;
|
||||
public declare _WidgetLayoutStore?: WidgetLayoutStore;
|
||||
public declare _WidgetStore?: WidgetStore;
|
||||
public declare _PosthogAnalytics?: PosthogAnalytics;
|
||||
public declare _SlidingSyncManager?: SlidingSyncManager;
|
||||
public declare _SpaceStore?: SpaceStoreClass;
|
||||
public declare _VoiceBroadcastRecordingsStore?: VoiceBroadcastRecordingsStore;
|
||||
public declare _VoiceBroadcastPreRecordingStore?: VoiceBroadcastPreRecordingStore;
|
||||
public declare _VoiceBroadcastPlaybacksStore?: VoiceBroadcastPlaybacksStore;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
|
|
@ -43,6 +43,7 @@ export class MockedCall extends Call {
|
|||
},
|
||||
room.client,
|
||||
);
|
||||
this.groupCall = { creationTs: this.event.getTs() } as unknown as GroupCall;
|
||||
}
|
||||
|
||||
public static get(room: Room): MockedCall | null {
|
||||
|
@ -67,7 +68,7 @@ export class MockedCall extends Call {
|
|||
CallStore.instance.updateRoom(room);
|
||||
}
|
||||
|
||||
public readonly groupCall = { creationTs: this.event.getTs() } as unknown as GroupCall;
|
||||
public readonly groupCall: GroupCall;
|
||||
|
||||
public get participants(): Map<RoomMember, Set<string>> {
|
||||
return super.participants;
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
"emitDecoratorMetadata": false,
|
||||
"resolveJsonModule": true,
|
||||
"esModuleInterop": true,
|
||||
"useDefineForClassFields": true,
|
||||
"module": "es2022",
|
||||
"moduleResolution": "node",
|
||||
"target": "es2018",
|
||||
"target": "es2022",
|
||||
"noUnusedLocals": true,
|
||||
"sourceMap": false,
|
||||
"outDir": "./lib",
|
||||
|
|
Loading…
Reference in New Issue