Last week, the team behind TypeScript announced the availability of TypeScript 3.6 Beta. The full release of TypeScript 3.6 is scheduled for the end of the next month with a Release Candidate coming a few weeks prior.
What’s new in TypeScript 3.6?
TypeScript 3.6 comes with stricter checking for iterators and generator functions. The earlier versions didn’t let users of generators differentiate whether a value was yielded or returned from a generator. With TypeScript 3.6, users can narrow down values from iterators while dealing with them.
The emit for constructs like for/of loops and array spreads can be a bit heavy so TypeScript opts for a simpler emit by default that supports array types, and helps in iterating on other types using the –downlevelIteration flag. With this flag, the emitted code is more accurate, but is larger.
Semicolon-aware code edits
Older versions of TypeScript added semicolons to the end of every statement which was not appreciated by many users as it didn’t go along with their style guidelines. TypeScript 3.6 can easily detect if a file uses semicolons while applying edits and if a file lack semicolons, TypeScript doesn’t add one.
Following are a few of the declarations that have been removed or changed within lib.dom.d.ts:
- Instead of GlobalFetch, WindowOrWorkerGlobalScope is used.
- Non-standard properties on Navigator no more exist.
- webgl or webgl2 is used instead of experimental-webgl context.
To know more about this news, check out the official post.