TypeScript 2.2 plays nice with React Native JavaScript

From InfoWorld: Microsoft's TypeScript language is approaching its 2.2 release with an emphasis on support for React Native, Facebook's JavaScript framework for building native mobile apps.

The upgrade has moved to a release candidate status, which is commonly the last stage before general availability, and a road map for the language has version 2.2 arriving this month.

For React Native, which enables building of native apps via Facebook's React framework and JavaScript, TypeScript 2.2 offers a JSX emit mode, called react-native, to accommodate React Native's loader by generating .js files. The loader expects all input to be .js files. "It also satisfies cases where you want to just leave your JSX syntax alone but get .js files out from TypeScript," Daniel Rosenwasser, Microsoft program manager for TypeScript, said. JSX provides TypeScript with an embeddable XML-like syntax.

Version 2.2 also introduces an object type that lets a developer perform an object primitive type parameter, which should help catch a large class of bugs while more accurately modeling real-world code. To improve support for the mixin pattern, restrictions have been removed on classes. Developers can write a function that takes a constructor, declares a class that extends the constructor, adds members to the new class, and returns the class itself. Mixins enable building up classes from reusable components by combining simpler, partial classes.

View: Article @ Source Site