Reputation: 1482
I tried writing image: HTMLImageElement
in my browser console today. I expected an error would occur, but it didn't.
This does not declare a variable as var image: HTMLImageElement
on TypeScript does, and it also does not define a property as var x = { image: HTMLImageElement }
does. It seems that this actually does nothing. What does this syntax do?
Upvotes: 0
Views: 99
Reputation: 128781
Unless within an object, text followed by a colon in JavaScript is a labelled statement. An example labelled statement which you will have probably seen before is:
<a href="javascript: void(0)">
In this case, javascript
is the label and void(0)
is the statement. In your case, image
is the label and HTMLImageElement
is the statement.
Upvotes: 1