To start a new Ember project with TypeScript, add the
--typescript flag when you run
ember new my-typescript-app --typescript
--typescript flag changes the output of
ember new in a few ways:
Project files will be generated with
.ts extensions instead of
In addition to the usual packages added with
ember new, the following packages will be added at their current "latest" value:
typescript package provides tooling to support TypeScript type checking and compilation. The
@types packages from DefinitelyTyped provide TypeScript type definitions for all of the Ember and EmberData modules.
In addition to the usual files added with
ember new, we also add:
tsconfig.json– configuration to set up TypeScript for your project
types/global.d.ts– the location for any global type declarations you need to write
app/config/environment.d.ts– a basic set of types defined for the contents of your
package.jsonwill have a
lint:typesscript to check types with the command line.
ember-cli-build.jswill be configured to transform TypeScript at build-time.
.eslintrc.jswill be configured for TypeScript.
To convert an existing app to TypeScript, you'll need to make the changes described above manually (for now). To facilitate this, we've included a guide here.