html5 - How can I use DOMStringMap in TypeScript? -


let's have function:

angular.foreach(myelements, function prepareelements(myel: htmlelement, index) {     myel.dataset.myproperty = "whatever"; }) 

the problem error ts2094: property 'myproperty' not exist on value of type 'domstringmap'

i don't understand interface in lib.d.ts

interface domstringmap { } declare var domstringmap: {     prototype: domstringmap;     new (): domstringmap; } 

then later on...

interface htmlelement {     dataset: domstringmap;     hidden: boolean;     msgetinputcontext(): msinputmethodcontext; } 

is me or little unclear?

i tried casting <domstringmap>myel.dataset.myproperty = "whatever", did nothing...

the domstringmap interface empty because spec not finalized : https://developer.mozilla.org/en/docs/web/api/domstringmap

in meantime can use: myel.dataset['myproperty'] = "whatever";


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -