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

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -