typescript - Casting HTMLElement to HTMLAudioElement -
i have line of typescript:
var audio: htmlaudioelement = document.getelementbyid("audioelement");
however, build error:
type htmlelement not assignable type 'htmlaudioelement'.
is there different way should retrieving element htmlaudioelement, or cast htmlaudioelement?
the casting sutras typescript looks this:
var audio = <htmlaudioelement>document.getelementbyid("audioelement");
and can either specify type on audio variable if want, typescript pick automatically you.
Comments
Post a Comment