TypeScript 2.2 Adds More Code Actions |
Written by Kay Ewbank |
Monday, 27 February 2017 |
There's a new release of TypeScript with more code actions, a new object type, and easier string indexing behavior among its improvements. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. TypeScript was developed by Microsoft for creating complex applications, and is a built-in programming language for Visual Studio. It builds on the ECMAScript standard and adds type-checking. Your TypeScript code then gets transformed into clean, runnable JavaScript. Improvements to the new version start with better class support for mixins. This has been achieved by loosening some restrictions on classes, and by adjusting the way intersection types operate. These changs mean you can now express mixin-style classes in ES2015, where a class can extend anything that constructs some object type. This can be used to bridge ES2015 classes with APIs like The editor is another area that has been improved, with some more quick fixes (also called code actions), that can guide you in fixing up errors. This includes
There's a new object type in this version that matches any types except for primitive types. This means you can assign anything to the The string handling behavior has been improved with changes to string index signatures. These are part of a type and tell the type system what the result of an element access should be. The idea is that index signatures are meant to model the way that objects can serve as maps or dictionaries in JavaScript. In previous versions, you couldn't access a property via the string index very easily, but in this version you access it using code such as The developers have added a new option for JSX, emit mode. This joins the preserve and react options, and is like a combination of the two, in that it emits to The final notable change is the addition of support for .the new.target metaproperty added in ES2015. This lets constructors figure out if a subclass is being constructed. The developers are now working on TypeScript 2.3, and are planning to deliver
More InformationRelated ArticlesTypeScript 2.0 Adds Null, Undefined And Never Visual Studio "VS 15" Preview Released TypeScript Goes Light, Moves To GitHub TypeScript Fully Accepted into Visual Studio
To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
Comments
or email your comment to: comments@i-programmer.info |