Microsoft has released TypeScript 3.8, as Daniel Rosenwasser, Program Manager of TypeScript, announced in a blog post. TypeScript is a popular superset of JavaScript that adds syntax for types which can be analyzed through static type-checking before running the code.
SEE ALSO: Angular 9 – The Future of Angular with Ivy
The new release finalizes the features you may have tried out in the beta version that landed last month.
Top-level await
TypeScript users on Twitter are especially excited about the new feature top-level await
:
TypeScript 3.8 has arrived!
Now with
– type-only imports/exports
– private fields
– ‘export * as ns’ syntax
– top-level ‘await’
– convert to template string
– call hierarchyand more! Try it today!https://t.co/PMcmnsr5OB
— TypeScript (@typescript) February 20, 2020
Top-level await
is an upcoming ECMAScript feature that allows await
to be used at the top level of a module. Previously, this was only possible within the body of an async
function.
The new feature can be used as seen here:
const response = await fetch("..."); const greeting = await response.text(); console.log(greeting); // Make sure we're a module export {};
Source : JAXenter