From dfc37fa77ac20c4580f830b6431dd1cbe56b8a56 Mon Sep 17 00:00:00 2001 From: Kevin Wang Date: Thu, 1 Apr 2021 15:06:11 -0400 Subject: [PATCH] stricter typing on resolution (#187) --- src/stream.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/stream.ts b/src/stream.ts index 851f6547..30808bc6 100644 --- a/src/stream.ts +++ b/src/stream.ts @@ -7,7 +7,7 @@ interface VideoConstraints { }; } -const resolutions = ['qvga', 'vga', 'shd', 'hd', 'fhd', 'qhd']; +const resolutions = ['qvga', 'vga', 'shd', 'hd', 'fhd', 'qhd'] as const; export const VideoConstraints: VideoConstraints = { qvga: { @@ -105,14 +105,14 @@ export interface Encoding { } export interface Constraints extends MediaStreamConstraints { - resolution: string; + resolution: typeof resolutions[number]; codec: string; simulcast?: boolean; sendEmptyOnMute?: boolean; preferredCodecProfile?: string; } -const defaults = { +const defaults: Constraints = { resolution: 'hd', codec: 'vp8', audio: true,