Fixing typipng in back

This commit is contained in:
David Négrier 2020-08-18 15:31:42 +02:00
parent cc1cb2f671
commit 6c5772e849
2 changed files with 9 additions and 3 deletions

View file

@ -301,7 +301,7 @@ export class IoSocketController {
console.warn('Invalid WEBRTC_SIGNAL message received: ', data);
return;
}
if(data && data.signal && (data.signal as any).type === "offer"){
if(data.signal.type === "offer"){
let roomOffer = this.offerScreenSharingByClient.get(data.roomId);
if(!roomOffer){
roomOffer = new Map<string, unknown>();

View file

@ -1,17 +1,22 @@
import * as tg from "generic-type-guard";
export const isSignalData =
new tg.IsInterface().withProperties({
type: tg.isOptional(tg.isString)
}).get();
export const isWebRtcSignalMessageInterface =
new tg.IsInterface().withProperties({
userId: tg.isString,
receiverId: tg.isString,
roomId: tg.isString,
signal: tg.isUnknown
signal: isSignalData
}).get();
export const isWebRtcScreenSharingSignalMessageInterface =
new tg.IsInterface().withProperties({
userId: tg.isString,
roomId: tg.isString,
signal: tg.isUnknown
signal: isSignalData
}).get();
export const isWebRtcScreenSharingStartMessageInterface =
new tg.IsInterface().withProperties({
@ -19,3 +24,4 @@ export const isWebRtcScreenSharingStartMessageInterface =
roomId: tg.isString
}).get();
export type WebRtcSignalMessageInterface = tg.GuardedType<typeof isWebRtcSignalMessageInterface>;
export type WebRtcScreenSharingMessageInterface = tg.GuardedType<typeof isWebRtcScreenSharingSignalMessageInterface>;