angular - Twilio Video with Typescript -
i created component angular 2 , typescript allow create video calls using library twilio video. trying create custom typing typescript of library twilio-video, way used in other posts like:
declare var twilio:any; work when used twilio client library, not twilio video.
interface twilio { //other declarations here video: any; } declare namespace twilio { //others interface here connection , device client library interface video { connect(token: string, options?:object): promise; createlocaltracks(options?:object): promise; //other declarations of methods } } and can declare:
declare var twilio:twilio; with these custom type work video call, can create room , create local tracks, cannot use disable or enable methods localtrack, review code of library twilio-video , read create custom types , think library necesary used template show here, that:
export namespace twilio; export = video; declare class video { connect(token:string, options: object): promise; createlocaltracks(options?: object): promise; //other declarations of functions of video } declare namespace video { export interface localvideotrack { new(mediastream:any, mediastreamtrack:any, options:object); disable():void; enable():void; } } that way can used namespace twilio, cannot declare nothing using twilio.video library used, cannot use instanceof cast var, , don't have relationship code of library.
the primary problem me cannot declare correctly custom typescript typing used functions declared in twilio video library. new using typescript few weeks ago.
Comments
Post a Comment