javascript - HTMLAnchor element download not working in Typescript -


i can't htmlanchor element's download property work under typescript. i'm using following code:

var element = document.createelement('a');     element.href = 'data:attachment/csv,' + encodeuricomponent(csvcontent);     element.target = '_blank';     element.mimetype = "attachment/csv";     element.download = 'report.csv';  /* #debug 030314  line fails */     document.body.appendchild(element);     element.click(); 

it seems download property isn't supported in typescript. there work-around, adds .csv suffix file? - possible bypass typescript , call javascript code directly?

you can add yourself:

// tell typescript interface htmlanchorelement{     download:string;     }   var element = document.createelement('a');     element.href = 'data:attachment/csv,' + encodeuricomponent(csvcontent);     element.target = '_blank';     element.mimetype = "attachment/csv";     element.download = 'report.csv';  /* no error on line anymore */     document.body.appendchild(element);     element.click(); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -