/awaitSyncCodeInTypeScript

proof of concept that its possible to awaiting sync call in TS

Primary LanguageTypeScriptApache License 2.0Apache-2.0

awaitSyncCodeInTypeScript

proof of concept that its possible to awaiting sync call in TS

bit of code to test if awaiting of sync function is possible in typecript, how it transpiles and if it works in IE with es6-promise shim.

according to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await :

If the value is not a Promise, it converts the value to a resolved Promise, and waits for it.

async function f2() {
  var y = await 20;
  console.log(y); // 20
}
f2();

it seems, we are safe also in the future, until spec changes :)