|TypeScript 3.6 Generators Get Stricter|
|Written by Kay Ewbank|
|Friday, 30 August 2019|
Tools like the TypeScript compiler and Babel are then used to transform TypeScript to standards-compliant ECMAScript code that will work on any browser or runtime. TypeScript includes editor support for Visual Studio 2015 and 2017, Sublime Text 3 and Visual Studio Code.
The first change to the new version is the introduction of stricter checking for iterators and generator functions. Until now, if you used a generator there was no way to differentiate whether a value was yielded or returned from a generator. Changes have been made in the Interator and IteratorResult type declarations to include new type parameters, and to a new type that TypeScript uses to represent generators called the
Promise handling has also been improved, so that if they are mishandled in your code, for example by forgetting to include an await to make sure the Promise has been fulfilled before passing it to another function, you'll now get a clearer error message explaining this.
Array spreads are another area to be improved. Until now, TypeScript has used a simplified emit by default for constructs like
The TypeScript playground is another area to be improved with new options including:
The options also persist when sharing links to playground samples.The developers say that they'll be refreshing the playground samples in the near future, adding JSX support, and polishing automatic type acquisition, meaning that you’ll be able to see the same experience on the playground as you’d get in your personal editor.
or email your comment to: email@example.com
|Last Updated ( Saturday, 31 August 2019 )|