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>
This commit is contained in:
Michael Telatynski
2024-08-01 17:14:28 +01:00
committed by GitHub
parent 9cd0c247a2
commit c1d4199b02
68 changed files with 86 additions and 148 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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(),

View File

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

View File

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

View File

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

View File

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

View File

@@ -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(),

View File

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

View File

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