Running ES6/7 on the JVM with TypeScript and Vert.x
vertx-lang-typescript lets you run TypeScript verticles on the JVM, bringing ES6/7 features like arrow functions, classes, and the exponentiation operator to Vert.x 3.2.

The latest Vert.x 3.2 release, paired with vertx-lang-typescript 1.1.0, makes it possible to write Vert.x verticles in TypeScript and execute them directly on the JVM. The library compiles TypeScript to JavaScript on the fly and ships type definitions for the Vert.x JavaScript API, giving you IDE autocompletion and inline docs.
This isn't just about TypeScript's type system—it's about getting ECMAScript 6 and 7 features into your JVM-based stack today. The example verticle in the post demonstrates nine ES6/7 features in a single HTTP server:
- Arrow functions for request handlers
- Block-scoped variables with
let - Default parameter values
- Rest parameters and spread operator
for…ofloops- Template strings with interpolation
- Classes and inheritance
- The ES7 exponentiation operator (
**)
You run the verticle with a single command: vertx run es7verticle.ts. No NPM package wrapping, no separate build step. That's a cleaner workflow compared to the Babel-based approach Vert.x previously recommended, which required npm run build then npm start and locked you into a single-language project.
The trade-off: vertx-lang-typescript currently only supports the exponentiation operator from ES7. TypeScript 1.7's decorators are disabled because they're still experimental. If you need the full ES7 spec, you'll have to wait for future releases or stick with Babel.
For larger Vert.x applications with many verticles, the static typing and IDE support are genuine wins. The library works with Sublime, VS Code, Eclipse, and Atom. And because vertx-lang-typescript compiles on the fly, you can mix TypeScript verticles with Java or JavaScript ones in the same project—something the NPM-based Babel setup couldn't do.
If you're already on Vert.x and want modern JavaScript syntax without leaving the JVM, this is worth a look. Just don't expect a full ES7 playground yet.
Discussion
0 Comments
Be the first to start the discussion.