From cc4da5c7a729fa692a182edc4df36854d8e8ec40 Mon Sep 17 00:00:00 2001 From: Bruno Windels <274386+bwindels@users.noreply.github.com> Date: Tue, 28 Mar 2023 18:14:09 +0200 Subject: [PATCH] fix ts errors with latest tsc 4.x version (as used on CI) --- src/matrix/calls/TurnServerSource.ts | 2 ++ .../e2ee/megolm/decryption/KeyLoader.ts | 2 +- .../megolm/decryption/SessionDecryption.ts | 4 ++- src/platform/web/dom/MediaDevices.ts | 2 +- src/platform/web/ui/general/TemplateView.ts | 20 ++++++------ yarn.lock | 32 ++++++++++--------- 6 files changed, 34 insertions(+), 28 deletions(-) diff --git a/src/matrix/calls/TurnServerSource.ts b/src/matrix/calls/TurnServerSource.ts index a9163349..dd8e8f54 100644 --- a/src/matrix/calls/TurnServerSource.ts +++ b/src/matrix/calls/TurnServerSource.ts @@ -152,6 +152,8 @@ function toIceServer(settings: TurnServerSettings): RTCIceServer { urls: settings.uris, username: settings.username, credential: settings.password, + // @ts-ignore + // this field is deprecated but providing it nonetheless credentialType: "password" } } diff --git a/src/matrix/e2ee/megolm/decryption/KeyLoader.ts b/src/matrix/e2ee/megolm/decryption/KeyLoader.ts index 884203a3..ee3996aa 100644 --- a/src/matrix/e2ee/megolm/decryption/KeyLoader.ts +++ b/src/matrix/e2ee/megolm/decryption/KeyLoader.ts @@ -243,7 +243,7 @@ export function tests() { get keySource(): KeySource { return KeySource.DeviceMessage; } loadInto(session: Olm.InboundGroupSession) { - const mockSession = session as MockInboundSession; + const mockSession = session as unknown as MockInboundSession; mockSession.sessionId = this.sessionId; mockSession.firstKnownIndex = this._firstKnownIndex; } diff --git a/src/matrix/e2ee/megolm/decryption/SessionDecryption.ts b/src/matrix/e2ee/megolm/decryption/SessionDecryption.ts index 72af718c..508e6258 100644 --- a/src/matrix/e2ee/megolm/decryption/SessionDecryption.ts +++ b/src/matrix/e2ee/megolm/decryption/SessionDecryption.ts @@ -58,7 +58,9 @@ export class SessionDecryption { this.decryptionRequests!.push(request); decryptionResult = await request.response(); } else { - decryptionResult = session.decrypt(ciphertext) as OlmDecryptionResult; + // the return type of Olm.InboundGroupSession::decrypt is likely wrong, message_index is a number and not a string AFAIK + // getting it fixed upstream but fixing it like this for now. + decryptionResult = session.decrypt(ciphertext) as unknown as OlmDecryptionResult; } const {plaintext} = decryptionResult!; let payload; diff --git a/src/platform/web/dom/MediaDevices.ts b/src/platform/web/dom/MediaDevices.ts index d6439faa..04d3e8e4 100644 --- a/src/platform/web/dom/MediaDevices.ts +++ b/src/platform/web/dom/MediaDevices.ts @@ -65,7 +65,7 @@ export class MediaDevicesWrapper implements IMediaDevices { }; } - private getScreenshareContraints(): DisplayMediaStreamConstraints { + private getScreenshareContraints(): MediaStreamConstraints { return { audio: false, video: true, diff --git a/src/platform/web/ui/general/TemplateView.ts b/src/platform/web/ui/general/TemplateView.ts index 3b65ed9c..68a6fa4e 100644 --- a/src/platform/web/ui/general/TemplateView.ts +++ b/src/platform/web/ui/general/TemplateView.ts @@ -29,17 +29,17 @@ function objHasFns(obj: ClassNames): obj is { [className: string]: bool return false; } -export type RenderFn = (t: Builder, vm: T) => ViewNode; -type TextBinding = (T) => string | number | boolean | undefined | null; -type Child = NonBoundChild | TextBinding; -type Children = Child | Child[]; +export type RenderFn = (t: Builder, vm: T) => ViewNode; +type TextBinding = (T) => string | number | boolean | undefined | null; +type Child = NonBoundChild | TextBinding; +type Children = Child | Child[]; type EventHandler = ((event: Event) => void); type AttributeStaticValue = string | boolean; -type AttributeBinding = (value: T) => AttributeStaticValue; -export type AttrValue = AttributeStaticValue | AttributeBinding | EventHandler | ClassNames; -export type Attributes = { [attribute: string]: AttrValue }; -type ElementFn = (attributes?: Attributes | Children, children?: Children) => Element; -export type Builder = TemplateBuilder & { [tagName in typeof TAG_NAMES[string][number]]: ElementFn }; +type AttributeBinding = (value: T) => AttributeStaticValue; +export type AttrValue = AttributeStaticValue | AttributeBinding | EventHandler | ClassNames; +export type Attributes = { [attribute: string]: AttrValue }; +type ElementFn = (attributes?: Attributes | Children, children?: Children) => Element; +export type Builder = TemplateBuilder & { [tagName in typeof TAG_NAMES[string][number]]: ElementFn }; /** Bindable template. Renders once, and allows bindings for given nodes. If you need @@ -394,7 +394,7 @@ for (const [ns, tags] of Object.entries(TAG_NAMES)) { } } -export class InlineTemplateView extends TemplateView { +export class InlineTemplateView extends TemplateView { private _render: RenderFn; constructor(value: T, render: RenderFn) { diff --git a/yarn.lock b/yarn.lock index 876917a8..0db770d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -83,12 +83,14 @@ fastq "^1.6.0" "@playwright/test@^1.27.1": - version "1.27.1" - resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.27.1.tgz#9364d1e02021261211c8ff586d903faa79ce95c4" - integrity sha512-mrL2q0an/7tVqniQQF6RBL2saskjljXzqNcCOVMUjRIgE6Y38nCNaP+Dc2FBW06bcpD3tqIws/HT9qiMHbNU0A== + version "1.32.1" + resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.32.1.tgz#749c9791adb048c266277a39ba0f7e33fe593ffe" + integrity sha512-FTwjCuhlm1qHUGf4hWjfr64UMJD/z0hXYbk+O387Ioe6WdyZQ+0TBDAc6P+pHjx2xCv1VYNgrKbYrNixFWy4Dg== dependencies: "@types/node" "*" - playwright-core "1.27.1" + playwright-core "1.32.1" + optionalDependencies: + fsevents "2.3.2" "@trysound/sax@0.2.0": version "0.2.0" @@ -101,9 +103,9 @@ integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== "@types/node@*": - version "18.7.13" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.13.tgz#23e6c5168333480d454243378b69e861ab5c011a" - integrity sha512-46yIhxSe5xEaJZXWdIBP7GU4HDTG8/eo0qd9atdiL+lFpA03y8KS+lkTN834TWJj5767GbWv4n/P6efyTFt1Dw== + version "18.15.10" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.10.tgz#4ee2171c3306a185d1208dad5f44dae3dee4cfe3" + integrity sha512-9avDaQJczATcXgfmMAW3MIWArOO7A+m90vuCFLr8AotWf8igO/mRoYukrk2cqZVtv38tHs33retzHEilM7FpeQ== "@typescript-eslint/eslint-plugin@^4.29.2": version "4.29.2" @@ -1003,7 +1005,7 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= -fsevents@~2.3.2: +fsevents@2.3.2, fsevents@~2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== @@ -1382,10 +1384,10 @@ picomatch@^2.2.3: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== -playwright-core@1.27.1: - version "1.27.1" - resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.27.1.tgz#840ef662e55a3ed759d8b5d3d00a5f885a7184f4" - integrity sha512-9EmeXDncC2Pmp/z+teoVYlvmPWUC6ejSSYZUln7YaP89Z6lpAaiaAnqroUt/BoLo8tn7WYShcfaCh+xofZa44Q== +playwright-core@1.32.1: + version "1.32.1" + resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.32.1.tgz#5a10c32403323b07d75ea428ebeed866a80b76a1" + integrity sha512-KZYUQC10mXD2Am1rGlidaalNGYk3LU1vZqqNk0gT4XPty1jOqgup8KDP8l2CUlqoNKhXM5IfGjWgW37xvGllBA== postcss-css-variables@^0.18.0: version "0.18.0" @@ -1689,9 +1691,9 @@ type-fest@^0.20.2: integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== typescript@^4.7.0: - version "4.7.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" - integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== + version "4.9.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" + integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== typeson-registry@^1.0.0-alpha.20: version "1.0.0-alpha.39"