typewriter122739312801100692684orig

TypeScript 2.2 plays nice with React Native JavaScript

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.

Due in May, TypeScript 2.3 is set to feature generator support for ECMAScript 3 and 5, asynchronous iterators, and better support for literal types in JSX attributes. Other features planned for the language include variadic types, which support higher-order functions taking a variable number of parameters; project references; type-checking of computed properties for constraints and symbols; and bundling of module type definitions. Nominal typing support, enabling more-refined types, is being investigated as a possible addition to the language as well.

IDG Insider

PREVIOUS ARTICLE

« Review: Ultimaker 3 offers high-quality 3D print jobs -- s-l-o-w-l-y

NEXT ARTICLE

Cisco faces a tougher collaboration rival in updated Prysm »
author_image
IDG Connect

IDG Connect tackles the tech stories that matter to you

  • Mail

Recommended for You

20 Red-Hot, Pre-IPO companies to watch in 2019 B2B tech - Part 1

Martin Veitch's inside track on today’s tech trends

Training and certification for a cloud native world

Keri Allan looks at the latest trends and technologies

Unicorns are running free in the UK but Brexit poses a tough challenge

Trevor Clawson on the outlook for UK Tech startups

Poll

Do you think your smartphone is making you a workaholic?