Skip to content

Commit

Permalink
Make code tsc es2022 compliant (#4335)
Browse files Browse the repository at this point in the history
* Remove redundant global.d.ts definitions

Signed-off-by: Michael Telatynski <[email protected]>

* Remove roomId overload

Signed-off-by: Michael Telatynski <[email protected]>

* Update base.ts

---------

Signed-off-by: Michael Telatynski <[email protected]>
  • Loading branch information
t3chguy committed Aug 1, 2024
1 parent fbdd78b commit dfec3dc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 49 deletions.
45 changes: 0 additions & 45 deletions src/@types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,11 @@ declare global {

namespace NodeJS {
interface Global {
localStorage: Storage;
// marker variable used to detect both the browser & node entrypoints being used at once
__js_sdk_entrypoint: unknown;
}
}

interface Window {
webkitAudioContext: typeof AudioContext;
}

interface Crypto {
webkitSubtle?: Window["crypto"]["subtle"];
}

interface MediaDevices {
// This is experimental and types don't know about it yet
// https://github.com/microsoft/TypeScript/issues/33232
Expand Down Expand Up @@ -76,40 +67,4 @@ declare global {
// on webkit: we should check if we still need to do this
webkitGetUserMedia: DummyInterfaceWeShouldntBeUsingThis;
}

export interface ISettledFulfilled<T> {
status: "fulfilled";
value: T;
}
export interface ISettledRejected {
status: "rejected";
reason: any;
}

interface PromiseConstructor {
allSettled<T>(promises: Promise<T>[]): Promise<Array<ISettledFulfilled<T> | ISettledRejected>>;
}

interface RTCRtpTransceiver {
// This has been removed from TS
// (https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1029),
// but we still need this for MatrixCall::getRidOfRTXCodecs()
setCodecPreferences(codecs: RTCRtpCodecCapability[]): void;
}

interface RequestInit {
/**
* Specifies the priority of the fetch request relative to other requests of the same type.
* Must be one of the following strings:
* high: A high priority fetch request relative to other requests of the same type.
* low: A low priority fetch request relative to other requests of the same type.
* auto: Automatically determine the priority of the fetch request relative to other requests of the same type (default).
*
* @see https://html.spec.whatwg.org/multipage/urls-and-fetching.html#fetch-priority-attribute
* @see https://github.com/microsoft/TypeScript/issues/54472
* @see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API#browser_compatibility
* Not yet supported in Safari or Firefox
*/
priority?: "high" | "low" | "auto";
}
}
4 changes: 0 additions & 4 deletions src/crypto/algorithms/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export abstract class EncryptionAlgorithm {
protected readonly crypto: Crypto;
protected readonly olmDevice: OlmDevice;
protected readonly baseApis: MatrixClient;
protected readonly roomId?: string;

/**
* @param params - parameters
Expand All @@ -77,7 +76,6 @@ export abstract class EncryptionAlgorithm {
this.crypto = params.crypto;
this.olmDevice = params.olmDevice;
this.baseApis = params.baseApis;
this.roomId = params.roomId;
}

/**
Expand Down Expand Up @@ -127,14 +125,12 @@ export abstract class DecryptionAlgorithm {
protected readonly crypto: Crypto;
protected readonly olmDevice: OlmDevice;
protected readonly baseApis: MatrixClient;
protected readonly roomId?: string;

public constructor(params: DecryptionClassParams) {
this.userId = params.userId;
this.crypto = params.crypto;
this.olmDevice = params.olmDevice;
this.baseApis = params.baseApis;
this.roomId = params.roomId;
}

/**
Expand Down

0 comments on commit dfec3dc

Please sign in to comment.