Skip to content

Commit 54e8f3c

Browse files
authored
Simplify global types (#4831)
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
1 parent 1fcc375 commit 54e8f3c

File tree

2 files changed

+8
-32
lines changed

2 files changed

+8
-32
lines changed

src/@types/global.d.ts

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// this is needed to tell TS about globalThis.Olm
18-
import "@matrix-org/olm";
19-
2017
export {};
2118

2219
declare global {
@@ -34,39 +31,18 @@ declare global {
3431
}
3532
}
3633

37-
interface MediaDevices {
38-
// This is experimental and types don't know about it yet
39-
// https://github.com/microsoft/TypeScript/issues/33232
40-
getDisplayMedia(constraints: MediaStreamConstraints | DesktopCapturerConstraints): Promise<MediaStream>;
41-
getUserMedia(constraints: MediaStreamConstraints | DesktopCapturerConstraints): Promise<MediaStream>;
42-
}
43-
44-
interface DesktopCapturerConstraints {
45-
audio:
46-
| boolean
47-
| {
48-
mandatory: {
49-
chromeMediaSource: string;
50-
chromeMediaSourceId: string;
51-
};
52-
};
53-
video:
54-
| boolean
55-
| {
56-
mandatory: {
57-
chromeMediaSource: string;
58-
chromeMediaSourceId: string;
59-
};
60-
};
34+
// Chrome-specific getUserMedia constraints
35+
interface MediaTrackConstraints {
36+
mandatory?: {
37+
chromeMediaSource: string;
38+
chromeMediaSourceId: string;
39+
};
6140
}
6241

63-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
64-
interface DummyInterfaceWeShouldntBeUsingThis {}
65-
6642
interface Navigator {
6743
// We check for the webkit-prefixed getUserMedia to detect if we're
6844
// on webkit: we should check if we still need to do this
69-
webkitGetUserMedia?: DummyInterfaceWeShouldntBeUsingThis;
45+
webkitGetUserMedia?: unknown;
7046
}
7147

7248
export interface Uint8ArrayToBase64Options {

src/webrtc/mediaHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ export class MediaHandler extends TypedEventEmitter<
462462
};
463463
}
464464

465-
private getScreenshareContraints(opts: IScreensharingOpts): DesktopCapturerConstraints {
465+
private getScreenshareContraints(opts: IScreensharingOpts): MediaStreamConstraints {
466466
const { desktopCapturerSourceId, audio } = opts;
467467
if (desktopCapturerSourceId) {
468468
return {

0 commit comments

Comments
 (0)