I've noticed something strange while using TypeScript 1.8. I'm targeting ES5 and I was trying to use async/await. I know support for that is on the roadmap for 2.0, but it seems to partially work already?
For example, this doesn't compile:
module MyModule { async function myFunction() { ... } } The error is error TS1311: Async functions are only available when targeting ECMAScript 6 and higher. Pretty clear, right?
However, this does compile, and seems to work fine:
module MyModule { myFunction = async function () { ... } } This doesn't make sense to me. Why would the latter syntax work fine, while the former explictly refuses to compile? Is there a subtle difference to these two syntaxes that I'm missing?