我正在尝试使用一些javascript并将其翻译成打字稿,以便将其用于将利用Aurelia的网页。我在下面的行中遇到了一些语法问题。如果有人能指出我正确的方向,这将是非常感谢。线在下面。提前致谢
- 詹森
//trying to see if the browser supports HTML5 FileReader functionality
//VS currently says filereader does not exist on type 'Window'
if (window.filereader)
//VS says Property 'trigger' does not exist on type 'HTMLElement'
document.getElementById('fileBox').trigger('click');
//VS says Property 'click' does not exist on type 'Element'
document.querySelector('.fileCont span').click(function () {
this.remove();
});
// Property 'file' does not exist on type 'HTMLImageElement'
var img = document.createElement("img");
img.file = file;
答案 0 :(得分:0)
对于尚未进入标准定义文件的类型,您可以extend the interface to include the additional properties:
production: {
url: 'http://blog2.example.com',
mail: {},
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/content/data/ghost2.db')
},
debug: false
},
server: {
host: '127.0.0.1',
port: '2369'
}
}
如果您使用的是库,例如jQuery,则可以grab a ready-made definition for that。