Skip to content

Commit 9f1aebb

Browse files
authored
Bump ES target version to ES2022 (#4264)
* Bump ES target version to ES2022 I want to be able to use `WeakRef`, and per element-hq/element-web#24913 (comment), I believe this should be safe. * room.ts: Fix initialisation order It seems that ES2022 causes typescript to change the initialization order of regular properties vs parameter properties (microsoft/TypeScript#45995), so we need to rearrange the initializations to avoid an error. In practice, it might be fine because we have enabled `babel-plugin-transform-class-properties`, which moves the initialization back after the parameter property, but we shoudn't rely on that, and anyway it upsets the linter.
1 parent 6a15e8f commit 9f1aebb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/models/room.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,8 @@ export class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandlerMap> {
398398
* Use getLiveTimeline().getState(EventTimeline.FORWARDS) instead.
399399
*/
400400
public currentState!: RoomState;
401-
public readonly relations = new RelationsContainer(this.client, this);
401+
402+
public readonly relations;
402403

403404
/**
404405
* A collection of events known by the client
@@ -460,6 +461,7 @@ export class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandlerMap> {
460461
private readonly opts: IOpts = {},
461462
) {
462463
super();
464+
463465
// In some cases, we add listeners for every displayed Matrix event, so it's
464466
// common to have quite a few more than the default limit.
465467
this.setMaxListeners(100);
@@ -470,6 +472,8 @@ export class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandlerMap> {
470472
this.name = roomId;
471473
this.normalizedName = roomId;
472474

475+
this.relations = new RelationsContainer(this.client, this);
476+
473477
// Listen to our own receipt event as a more modular way of processing our own
474478
// receipts. No need to remove the listener: it's on ourself anyway.
475479
this.on(RoomEvent.Receipt, this.onReceipt);

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"compilerOptions": {
3-
"target": "es2016",
3+
"target": "es2022",
44
"experimentalDecorators": true,
55
"esModuleInterop": true,
66
"module": "commonjs",

0 commit comments

Comments
 (0)