When I run the first if check, everything works fine without any errors. However, when I move to the else block, an error is thrown.
The error message reads: 'VideoSource' only refers to a type, but is being used as a value here.
let element:VideoSource|VideoTrack;
element = {
src: '',
videoType: 'video/mp4'
}
if (element instanceof VideoTrack) {
}
else if (element instanceof VideoSource) {
}
export interface VideoSource {
src:string;
videoType:'video/mp4'|'video/webm'|'video/ogg';
}
export interface VideoTrack {
src:string;
kind: 'subtitles'|'captions'|'chapters'|'descriptions'|'metadata'
label?:string;
srclang?:string;
IsDefault?:'default';
}