ember-cli-typescript v2 release candidate

I and the rest of the “typed-ember” team are pleased to announce the first release candidate of the next version of TypeScript support in Ember.js apps and addons.

We’re very interested in your feedback. Please read this thoroughly, try out the release candidate and let us know if you run into any issues

Here’s what you need to know:

It relies on the new babel7 support for handling ts files

In ember-cli-typescript v1, we rely on the typescript compiler to turn typescript into JavaScript. This presents a few challenges:

Ember apps are transpiled with babel, and integrating an additional compiler (tsc) required some significant asset pipeline backflips. This never worked perfectly and resulted in some serious limitations around the use of other addons, as well as build performance penalties

With more than one compiler emitting JavaScript, great care must be taken in order to ensure that there’s consistency in how language features are treated. In particular, there are differences in how decorators are compiled in typescript, babel 6 and babel 7.

Babel 7 doesn’t really do TypeScript compilation, it just knows the subset of typescript code that can be stripped away in order to get valid JavaScript. It doesn’t in any way do type-checking, but rest easy…

You still get type-checking from TypeScript

In ember-cli-typescriptv2, although the TypeScript compiler is in no way responsible for generating JavaScript files, it still performs type-checking, and it’s still responsible for generating the appropriate output.d.tsfiles when precompiling addons for publishing.

One thing you should know: for projects that use decorators, the transpiled output files will be unnecessarily large

This is one last thing that’s being worked on is a build output size bloat, relative to the same project compiled with ember-cli-typescript v1. This is due to repeated babel helpers for decorators — pzuraq (you may know him as the ember-decorators maintainer) is working on a fix for this, which we hope will land next week.

How do I try this out?

Check out the installation instructions on our v2 branch.

Special thanks to Dan Freeman

He did the lion’s share of the work getting the project aligned with Ember’s babel conventions