Update dependency typescript to v6 (#32927)
* Update dependency typescript to v6 * Switch to unplugin-vts Workaround for https://github.com/qmhc/unplugin-dts/issues/467 And tweak tsconfigs * tweak tsconfig * Make tsc happy --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node",
|
||||
"moduleResolution": "node16",
|
||||
"module": "Node16",
|
||||
"esModuleInterop": true,
|
||||
"target": "es2022",
|
||||
"sourceMap": false,
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
"prettier": "^3.0.0",
|
||||
"rimraf": "^6.0.0",
|
||||
"tar": "^7.5.8",
|
||||
"typescript": "5.9.3"
|
||||
"typescript": "6.0.3"
|
||||
},
|
||||
"hakDependencies": {
|
||||
"matrix-seshat": "4.2.0"
|
||||
|
||||
@@ -17,14 +17,14 @@ import { PassThrough } from "node:stream";
|
||||
* A PassThrough stream that captures all data written to it.
|
||||
*/
|
||||
class CapturedPassThrough extends PassThrough {
|
||||
private _chunks = [];
|
||||
private _chunks: any[] = [];
|
||||
|
||||
public constructor() {
|
||||
super();
|
||||
super.on("data", this.onData);
|
||||
}
|
||||
|
||||
private onData = (chunk): void => {
|
||||
private onData = (chunk: any): void => {
|
||||
this._chunks.push(chunk);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"resolveJsonModule": true,
|
||||
"moduleResolution": "node",
|
||||
"moduleResolution": "bundler",
|
||||
"esModuleInterop": true,
|
||||
"target": "es2022",
|
||||
"module": "es2022",
|
||||
"lib": ["es2022", "dom"],
|
||||
"module": "ESNext",
|
||||
"lib": ["es2024", "dom", "dom.iterable"],
|
||||
"strictNullChecks": false,
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["**/*.ts"]
|
||||
|
||||
@@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import type { Locator, Page } from "@playwright/test";
|
||||
import { test, expect } from "../../element-web-test";
|
||||
import { test, expect, type ExtendedToMatchScreenshotOptions } from "../../element-web-test";
|
||||
import { SettingLevel } from "../../../src/settings/SettingLevel";
|
||||
import { Layout } from "../../../src/settings/enums/Layout";
|
||||
import { type ElementAppPage } from "../../pages/ElementAppPage";
|
||||
@@ -94,7 +94,7 @@ test.describe("Audio player", { tag: ["@no-firefox", "@no-webkit"] }, () => {
|
||||
// Assert that rendering of the player settled and the play button is visible before taking a snapshot
|
||||
await checkPlayerVisibility(ircTile);
|
||||
|
||||
const screenshotOptions = {
|
||||
const screenshotOptions: ExtendedToMatchScreenshotOptions = {
|
||||
css: `
|
||||
/* The timestamp is of inconsistent width depending on the time the test runs at */
|
||||
.mx_MessageTimestamp {
|
||||
@@ -120,7 +120,7 @@ test.describe("Audio player", { tag: ["@no-firefox", "@no-webkit"] }, () => {
|
||||
};
|
||||
|
||||
// Take a snapshot of mx_EventTile_last on IRC layout
|
||||
screenshotOptions.clip = await page.locator(".mx_EventTile_last").boundingBox();
|
||||
screenshotOptions.clip = (await page.locator(".mx_EventTile_last").boundingBox()) ?? undefined;
|
||||
await scrollToBottomOfTimeline(page);
|
||||
await expect(page).toMatchScreenshot(`${detail.replaceAll(" ", "-")}-irc-layout.png`, screenshotOptions);
|
||||
|
||||
@@ -129,7 +129,7 @@ test.describe("Audio player", { tag: ["@no-firefox", "@no-webkit"] }, () => {
|
||||
const groupTile = page.locator(".mx_EventTile_last[data-layout='group']");
|
||||
await groupTile.locator(".mx_MessageTimestamp").click();
|
||||
await checkPlayerVisibility(groupTile);
|
||||
screenshotOptions.clip = await page.locator(".mx_EventTile_last").boundingBox();
|
||||
screenshotOptions.clip = (await page.locator(".mx_EventTile_last").boundingBox()) ?? undefined;
|
||||
await scrollToBottomOfTimeline(page);
|
||||
await expect(page).toMatchScreenshot(`${detail.replaceAll(" ", "-")}-group-layout.png`, screenshotOptions);
|
||||
|
||||
@@ -138,7 +138,7 @@ test.describe("Audio player", { tag: ["@no-firefox", "@no-webkit"] }, () => {
|
||||
const bubbleTile = page.locator(".mx_EventTile_last[data-layout='bubble']");
|
||||
await bubbleTile.locator(".mx_MessageTimestamp").click();
|
||||
await checkPlayerVisibility(bubbleTile);
|
||||
screenshotOptions.clip = await page.locator(".mx_EventTile_last").boundingBox();
|
||||
screenshotOptions.clip = (await page.locator(".mx_EventTile_last").boundingBox()) ?? undefined;
|
||||
await scrollToBottomOfTimeline(page);
|
||||
await expect(page).toMatchScreenshot(`${detail.replaceAll(" ", "-")}-bubble-layout.png`, screenshotOptions);
|
||||
};
|
||||
|
||||
@@ -44,7 +44,7 @@ const bobJoin = async (page: Page, bob: Bot) => {
|
||||
const bobRooms = cli.getRooms();
|
||||
if (!bobRooms.length) {
|
||||
await new Promise<void>((resolve) => {
|
||||
const onMembership = (_event) => {
|
||||
const onMembership = () => {
|
||||
cli.off(window.matrixcs.RoomMemberEvent.Membership, onMembership);
|
||||
resolve();
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import type { EmittedEvents, Preset } from "matrix-js-sdk/src/matrix";
|
||||
import type { Preset, RoomMemberEvent, RoomStateEvent } from "matrix-js-sdk/src/matrix";
|
||||
import { expect, test } from "../../element-web-test";
|
||||
import {
|
||||
createRoom,
|
||||
@@ -122,7 +122,7 @@ test.describe("Cryptography", function () {
|
||||
const roomId = await bob.evaluate(
|
||||
async (client, { alice }) => {
|
||||
const encryptionStatePromise = new Promise<void>((resolve) => {
|
||||
client.on("RoomState.events" as EmittedEvents, (event, _state, _lastStateEvent) => {
|
||||
client.on("RoomState.events" as RoomStateEvent.Events, (event, _state, _lastStateEvent) => {
|
||||
if (event.getType() === "m.room.encryption") {
|
||||
resolve();
|
||||
}
|
||||
@@ -253,11 +253,14 @@ test.describe("Cryptography", function () {
|
||||
|
||||
// invite Alice
|
||||
const inviteAlicePromise = new Promise<void>((resolve) => {
|
||||
client.on("RoomMember.membership" as EmittedEvents, (_event, member, _oldMembership?) => {
|
||||
if (member.userId === alice.userId && member.membership === "invite") {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
client.on(
|
||||
"RoomMember.membership" as RoomMemberEvent.Membership,
|
||||
(_event, member, _oldMembership?) => {
|
||||
if (member.userId === alice.userId && member.membership === "invite") {
|
||||
resolve();
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
await client.invite(roomId, alice.userId);
|
||||
// wait for the invite to come back so that we encrypt to Alice
|
||||
@@ -271,11 +274,14 @@ test.describe("Cryptography", function () {
|
||||
|
||||
// kick Alice
|
||||
const kickAlicePromise = new Promise<void>((resolve) => {
|
||||
client.on("RoomMember.membership" as EmittedEvents, (_event, member, _oldMembership?) => {
|
||||
if (member.userId === alice.userId && member.membership === "leave") {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
client.on(
|
||||
"RoomMember.membership" as RoomMemberEvent.Membership,
|
||||
(_event, member, _oldMembership?) => {
|
||||
if (member.userId === alice.userId && member.membership === "leave") {
|
||||
resolve();
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
await client.kick(roomId, alice.userId);
|
||||
await kickAlicePromise;
|
||||
|
||||
@@ -166,13 +166,9 @@ async function getDehydratedDeviceIds(client: Client): Promise<string[]> {
|
||||
return await client.evaluate(async (client) => {
|
||||
const userId = client.getUserId();
|
||||
const devices = await client.getCrypto().getUserDeviceInfo([userId]);
|
||||
return Array.from(
|
||||
devices
|
||||
.get(userId)
|
||||
.values()
|
||||
.filter((d) => d.dehydrated)
|
||||
.map((d) => d.deviceId),
|
||||
);
|
||||
return Array.from(devices.get(userId).values())
|
||||
.filter((d) => d.dehydrated)
|
||||
.map((d) => d.deviceId);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -579,8 +579,8 @@ export async function deleteCachedSecrets(page: Page) {
|
||||
await page.evaluate(async () => {
|
||||
const removeCachedSecrets = new Promise((resolve) => {
|
||||
const request = window.indexedDB.open("matrix-js-sdk::matrix-sdk-crypto");
|
||||
request.onsuccess = (event: Event & { target: { result: IDBDatabase } }) => {
|
||||
const db = event.target.result;
|
||||
request.onsuccess = function (this: IDBRequest) {
|
||||
const db = this.result as IDBDatabase;
|
||||
const request = db.transaction("core", "readwrite").objectStore("core").delete("private_identity");
|
||||
request.onsuccess = () => {
|
||||
db.close();
|
||||
|
||||
@@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import type { JSHandle } from "@playwright/test";
|
||||
import type { MatrixEvent, ISendEventResponse, ReceiptType } from "matrix-js-sdk/src/matrix";
|
||||
import type { MatrixEvent, ISendEventResponse, ReceiptType, RelationType } from "matrix-js-sdk/src/matrix";
|
||||
import { expect } from "../../element-web-test";
|
||||
import { type ElementAppPage } from "../../pages/ElementAppPage";
|
||||
import { type Bot } from "../../pages/bot";
|
||||
@@ -47,7 +47,7 @@ test.describe("Read receipts", { tag: "@mergequeue" }, () => {
|
||||
getId: () => eventResponse.event_id,
|
||||
threadRootId,
|
||||
getTs: () => 1,
|
||||
isRelation: (relType) => {
|
||||
isRelation: (relType: RelationType) => {
|
||||
return !relType || relType === "m.thread";
|
||||
},
|
||||
} as any as MatrixEvent;
|
||||
|
||||
@@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import type { Locator, Page } from "@playwright/test";
|
||||
import type { ISendEventResponse, EventType, MsgType } from "matrix-js-sdk/src/matrix";
|
||||
import type { ISendEventResponse, EventType, MsgType, IContent } from "matrix-js-sdk/src/matrix";
|
||||
import { test, expect } from "../../element-web-test";
|
||||
import { SettingLevel } from "../../../src/settings/SettingLevel";
|
||||
import { Layout } from "../../../src/settings/enums/Layout";
|
||||
@@ -50,11 +50,9 @@ const expectAvatar = async (cli: Client, e: Locator, avatarUrl: string): Promise
|
||||
};
|
||||
|
||||
const sendEvent = async (client: Client, roomId: string, html = false): Promise<ISendEventResponse> => {
|
||||
const content = {
|
||||
const content: IContent = {
|
||||
msgtype: "m.text" as MsgType,
|
||||
body: "Message",
|
||||
format: undefined,
|
||||
formatted_body: undefined,
|
||||
};
|
||||
if (html) {
|
||||
content.format = "org.matrix.custom.html";
|
||||
|
||||
@@ -42,7 +42,7 @@ export async function waitForRoom(
|
||||
return new Promise<Room>((resolve) => {
|
||||
const room = matrixClient.getRoom(roomId);
|
||||
|
||||
if (window[predicateId](room)) {
|
||||
if ((<any>window)[predicateId](room)) {
|
||||
resolve(room);
|
||||
return;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ export async function waitForRoom(
|
||||
function onEvent(ev: MatrixEvent) {
|
||||
if (ev.getRoomId() !== roomId) return;
|
||||
|
||||
if (window[predicateId](room)) {
|
||||
if ((<any>window)[predicateId](room)) {
|
||||
matrixClient.removeListener("event" as ClientEvent, onEvent);
|
||||
resolve(room);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ export const test = base.extend<TestFixtures>({
|
||||
},
|
||||
});
|
||||
|
||||
interface ExtendedToMatchScreenshotOptions extends ToMatchScreenshotOptions {
|
||||
export interface ExtendedToMatchScreenshotOptions extends ToMatchScreenshotOptions {
|
||||
includeDialogBackground?: boolean;
|
||||
showTooltips?: boolean;
|
||||
timeout?: number;
|
||||
|
||||
@@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { type JSHandle, type Page } from "@playwright/test";
|
||||
import { type PageFunctionOn } from "playwright-core/types/structs";
|
||||
import { type ElementHandle } from "playwright-core";
|
||||
|
||||
import { Network } from "./network";
|
||||
import type {
|
||||
@@ -30,6 +30,34 @@ import type {
|
||||
import type { RoomMessageEventContent } from "matrix-js-sdk/src/types";
|
||||
import { type CredentialsOptionalAccessToken } from "./bot";
|
||||
|
||||
/** Types cribbed from playwright-core/types/structs as they are not importable */
|
||||
export type NoHandles<Arg> = Arg extends JSHandle
|
||||
? never
|
||||
: Arg extends object
|
||||
? { [Key in keyof Arg]: NoHandles<Arg[Key]> }
|
||||
: Arg;
|
||||
export type Unboxed<Arg> =
|
||||
Arg extends ElementHandle<infer T>
|
||||
? T
|
||||
: Arg extends JSHandle<infer T>
|
||||
? T
|
||||
: Arg extends NoHandles<Arg>
|
||||
? Arg
|
||||
: Arg extends [infer A0]
|
||||
? [Unboxed<A0>]
|
||||
: Arg extends [infer A0, infer A1]
|
||||
? [Unboxed<A0>, Unboxed<A1>]
|
||||
: Arg extends [infer A0, infer A1, infer A2]
|
||||
? [Unboxed<A0>, Unboxed<A1>, Unboxed<A2>]
|
||||
: Arg extends [infer A0, infer A1, infer A2, infer A3]
|
||||
? [Unboxed<A0>, Unboxed<A1>, Unboxed<A2>, Unboxed<A3>]
|
||||
: Arg extends Array<infer T>
|
||||
? Array<Unboxed<T>>
|
||||
: Arg extends object
|
||||
? { [Key in keyof Arg]: Unboxed<Arg[Key]> }
|
||||
: Arg;
|
||||
export type PageFunctionOn<On, Arg2, R> = string | ((on: On, arg2: Unboxed<Arg2>) => R | Promise<R>);
|
||||
|
||||
export class Client {
|
||||
public network: Network;
|
||||
protected client: JSHandle<MatrixClient>;
|
||||
|
||||
@@ -21,7 +21,7 @@ const DEFAULT_CONFIG = {
|
||||
global: {
|
||||
server_name: "localhost",
|
||||
private_key: "matrix_key.pem",
|
||||
old_private_keys: null,
|
||||
old_private_keys: null as any,
|
||||
key_validity_period: "168h0m0s",
|
||||
cache: {
|
||||
max_size_estimated: "1gb",
|
||||
@@ -47,7 +47,7 @@ const DEFAULT_CONFIG = {
|
||||
room_name: "Server Alerts",
|
||||
},
|
||||
jetstream: {
|
||||
addresses: null,
|
||||
addresses: null as any,
|
||||
disable_tls_validation: false,
|
||||
storage_path: "./",
|
||||
topic_prefix: "Dendrite",
|
||||
@@ -67,7 +67,7 @@ const DEFAULT_CONFIG = {
|
||||
},
|
||||
app_service_api: {
|
||||
disable_tls_validation: false,
|
||||
config_files: null,
|
||||
config_files: null as any,
|
||||
},
|
||||
client_api: {
|
||||
registration_disabled: false,
|
||||
@@ -79,14 +79,14 @@ const DEFAULT_CONFIG = {
|
||||
recaptcha_bypass_secret: "",
|
||||
turn: {
|
||||
turn_user_lifetime: "5m",
|
||||
turn_uris: null,
|
||||
turn_uris: null as any,
|
||||
turn_shared_secret: "",
|
||||
},
|
||||
rate_limiting: {
|
||||
enabled: true,
|
||||
threshold: 20,
|
||||
cooloff_ms: 500,
|
||||
exempt_user_ids: null,
|
||||
exempt_user_ids: null as any,
|
||||
},
|
||||
},
|
||||
federation_api: {
|
||||
@@ -140,7 +140,7 @@ const DEFAULT_CONFIG = {
|
||||
},
|
||||
},
|
||||
mscs: {
|
||||
mscs: null,
|
||||
mscs: null as any,
|
||||
database: {
|
||||
connection_string: "file:dendrite-msc.db",
|
||||
},
|
||||
@@ -157,7 +157,7 @@ const DEFAULT_CONFIG = {
|
||||
},
|
||||
user_api: {
|
||||
bcrypt_cost: 10,
|
||||
auto_join_rooms: null,
|
||||
auto_join_rooms: null as any,
|
||||
account_database: {
|
||||
connection_string: "file:dendrite-userapi.db",
|
||||
},
|
||||
@@ -183,12 +183,12 @@ const DEFAULT_CONFIG = {
|
||||
serviceName: "",
|
||||
disabled: false,
|
||||
rpc_metrics: false,
|
||||
tags: [],
|
||||
sampler: null,
|
||||
reporter: null,
|
||||
headers: null,
|
||||
baggage_restrictions: null,
|
||||
throttler: null,
|
||||
tags: [] as any[],
|
||||
sampler: null as any,
|
||||
reporter: null as any,
|
||||
headers: null as any,
|
||||
baggage_restrictions: null as any,
|
||||
throttler: null as any,
|
||||
},
|
||||
},
|
||||
logging: [
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
"compilerOptions": {
|
||||
"target": "es2022",
|
||||
"jsx": "react",
|
||||
"lib": ["ESNext", "es2022", "dom", "dom.iterable"],
|
||||
"lib": ["es2024", "dom", "dom.iterable"],
|
||||
"resolveJsonModule": true,
|
||||
"esModuleInterop": true,
|
||||
"moduleResolution": "node",
|
||||
"module": "es2022",
|
||||
"moduleResolution": "bundler",
|
||||
"module": "ESNext",
|
||||
"allowImportingTsExtensions": true,
|
||||
"strictNullChecks": false,
|
||||
"noImplicitAny": false,
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": [
|
||||
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Copyright 2026 Element Creations Ltd.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
declare module "*.css";
|
||||
Vendored
-9
@@ -8,7 +8,6 @@ Please see LICENSE files in the repository root for full details.
|
||||
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import "matrix-js-sdk/src/@types/global"; // load matrix-js-sdk's type extensions first
|
||||
import "@types/modernizr";
|
||||
|
||||
import type { ModuleLoader } from "@element-hq/element-web-module-api";
|
||||
import type { logger } from "matrix-js-sdk/src/logger";
|
||||
@@ -186,14 +185,6 @@ declare global {
|
||||
readonly port: MessagePort;
|
||||
}
|
||||
|
||||
/**
|
||||
* In future, browsers will support focusVisible option.
|
||||
* See https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#focusvisible
|
||||
*/
|
||||
interface FocusOptions {
|
||||
focusVisible: boolean;
|
||||
}
|
||||
|
||||
// https://github.com/microsoft/TypeScript/issues/28308#issuecomment-650802278
|
||||
function registerProcessor(
|
||||
name: string,
|
||||
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Copyright 2026 Element Creations Ltd.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
declare module "*.pcss";
|
||||
@@ -16,7 +16,7 @@
|
||||
"jsx": "react",
|
||||
"lib": ["es2022", "es2024.promise", "dom", "dom.iterable"],
|
||||
"strict": true,
|
||||
"types": ["node"],
|
||||
"types": ["node", "modernizr"],
|
||||
"paths": {
|
||||
"jest-matrix-react": ["./test/test-utils/jest-matrix-react"],
|
||||
"rollup/parseAst": ["../../node_modules/rollup/dist/parseAst"]
|
||||
|
||||
Reference in New Issue
Block a user