Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ember-cli-typescript

typed-ember2.6mMIT5.3.0TypeScript support: included

Allow Ember apps to use TypeScript files.

ember-addon, typescript

readme

MAINTENANCE MODE

ember-cli-typescript will no longer be updated unless necessary - ec-ts is no longer needed and all available features are configurable in userland.

See the official TypeScript docs on the ember guides website here: https://guides.emberjs.com/release/typescript/ This section of the docs has details for getting started with TypeScript, beyond what is laid out here.

With every release, we output the --typescript output of new ember apps to this StackBlitz: https://stackblitz.com/github/ember-cli/editor-output/tree/stackblitz-app-output-typescript

How to use TypeScript without ember-cli-typescript?

Apps and v1 addons need to configure Babel to compile TypeScript files via the ember-cli-babel config, as described in the ember-cli-babel.

Additionally, you will need the tsconfig.json generated by the Ember TypeScript blueprint (see below for details), and then can run glint or tsc directly on the CLI. (Again, see the official docs for details!)

Apps

'ember-cli-babel': {
  enableTypeScriptTransform: true,
},

v1 addons

Configure this in the addon's index.js in the root of the project:

module.exports = {
  name: require('package').name,
  options: {
    'ember-cli-babel': {
      enableTypeScriptTransform: true
    }
  }
}

v2 addons

The V2 Addon Blueprint does not use nor need ember-cli-typescript, nor any of its features.

What tsconfig.json should be used?

The official blueprints for apps and v1 addons (as of 2023-12-06) specifies:

<summary>for apps</summary>
{
  "extends": "@tsconfig/ember/tsconfig.json",
  "compilerOptions": {
    // The combination of `baseUrl` with `paths` allows Ember's classic package
    // layout, which is not resolvable with the Node resolution algorithm, to
    // work with TypeScript.
    "baseUrl": ".",
    "paths": {
      "<%= name %>/tests/*": ["tests/*"],
      "<%= name %>/*": ["app/*"],
      "*": ["types/*"]
    }
  }
}
<summary>For v1 addons</summary>
{
  "extends": "@tsconfig/ember/tsconfig.json",
  "compilerOptions": {
    // The combination of `baseUrl` with `paths` allows Ember's classic package
    // layout, which is not resolvable with the Node resolution algorithm, to
    // work with TypeScript.
    "baseUrl": ".",
    "paths": {
      "dummy/tests/*": ["tests/*"],
      "dummy/*": ["tests/dummy/app/*", "app/*"],
      "<%= addonName %>": ["addon"],
      "<%= addonName %>/*": ["addon/*"],
      "<%= addonName %>/test-support": ["addon-test-support"],
      "<%= addonName %>/test-support/*": ["addon-test-support/*"],
      "*": ["types/*"]
    }
  }
}

What @types/* packages do I install?

<summary>if you're using ember-data</summary>
"@types/ember": "^4.0.8",
"@types/ember-data": "^4.4.13",
"@types/ember-data__adapter": "^4.0.4",
"@types/ember-data__model": "^4.0.3",
"@types/ember-data__serializer": "^4.0.4",
"@types/ember-data__store": "^4.0.5",
"@types/ember__application": "^4.0.9",
"@types/ember__array": "^4.0.7",
"@types/ember__component": "^4.0.19",
"@types/ember__controller": "^4.0.9",
"@types/ember__debug": "^4.0.6",
"@types/ember__destroyable": "^4.0.3",
"@types/ember__engine": "^4.0.8",
"@types/ember__error": "^4.0.4",
"@types/ember__helper": "^4.0.4",
"@types/ember__modifier": "^4.0.7",
"@types/ember__object": "^4.0.9",
"@types/ember__owner": "^4.0.7",
"@types/ember__polyfills": "^4.0.4",
"@types/ember__routing": "^4.0.17",
"@types/ember__runloop": "^4.0.7",
"@types/ember__service": "^4.0.6",
"@types/ember__string": "^3.16.3",
"@types/ember__template": "^4.0.4",
"@types/ember__test": "^4.0.4",
"@types/ember__utils": "^4.0.5",
"@types/qunit": "^2.19.7",
"@types/rsvp": "^4.0.6",
<summary>if you're not using ember-data</summary>

You can use ember's built in types, so you only need the following:

"@types/qunit": "^2.19.7",
"@types/rsvp": "^4.0.6",

Note that ember-data will eventually ship their own types, and allow everyone to remove all the DT types.


ember-cli-typescript

Use TypeScript in your Ember 2.x and 3.x apps!

Actions Status Ember Observer Score

Documentation

This README focuses on basic information about setting up and using the addon. For more details, see the documentation, which includes:

  • troubleshooting tips
  • a walkthrough for using TypeScript with Ember effectively
  • guides for publishing addons written in TypeScript
  • more details on how the addon sets up your project during installation

…and much more!

Usage

Installation and Setup

You can simply ember install the dependency like normal:

ember install ember-cli-typescript@latest

All dependencies will be added to your package.json, and you're ready to roll! If you're upgrading from a previous release, see below! you should check to merge any tweaks you've made to tsconfig.json.

Upgrading from 1.x

There are a number of important changes between ember-cli-typescript v1 and v2, which mean the upgrade process is straightforward but specific:

  1. Update ember-cli-babel. Fix any problems introduced during the upgrade.
  2. Update ember-decorators. Fix any problems introduced during the upgrade.
  3. Update ember-cli-typescript. Follow the detailed upgrade guide below to fix discrepancies between Babel and TypeScript's compiled output.

If you deviate from this order, you are likely to have a much more difficult time upgrading!

Update ember-cli-babel

ember-cli-typescript requires ember-cli-babel at version 7.1.0 or above, which requires ember-cli 2.13 or above. It also requires @babel/core 7.2.0 or higher.

The recommended approach here is to deduplicate existing installations of the dependency, remove and reinstall ember-cli-babel to make sure that all its transitive dependencies are updated to the latest possible, and then to deduplicate again.

If using yarn:

npx yarn-deduplicate
yarn remove ember-cli-babel
yarn add --dev ember-cli-babel
npx yarn-deduplicate

If using npm:

npm dedupe
npm uninstall ember-cli-babel
npm install --save-dev ember-cli-babel
npm dedupe

Note: If you are also using ember-decorators—and specifically the babel-transform that gets added with it—you will need update @ember-decorators/babel-transforms as well (anything over 3.1.0 should work):

ember install ember-decorators@^3.1.0 @ember-decorators/babel-transforms@^3.1.0

Update ember-decorators

If you're on a version of Ember before 3.10, follow the same process of deduplication, reinstallation, and re-deduplication as described for ember-cli-babel above for ember-decorators. This will get you the latest version of ember-decorators and, importantly, its @ember-decorators/babel-transforms dependency.

Update ember-cli-typescript

Now you can simply ember install the dependency like normal:

ember install ember-cli-typescript@latest

Note: To work properly, starting from v2, ember-cli-typescript must be declared as a dependency, not a devDependency for addons. With ember install this migration will be automatically handled for you.

If you choose to make the upgrade manually with yarn or npm, here are the steps you need to follow:

  1. Remove ember-cli-typescript from your devDependencies.

    With yarn:

     yarn remove ember-cli-typescript

    With npm:

     npm uninstall ember-cli-typescript
  2. Install the latest of ember-cli-typescript as a dependency:

    With yarn:

     yarn add ember-cli-typescript@latest

    With npm:

     npm install --save ember-cli-typescript@latest
  3. Run ember generate:

     ember generate ember-cli-typescript
Account for addon build pipeline changes

Since we now integrate in a more traditional way into Ember CLI's build pipeline, there are two changes required for addons using TypeScript.

  • Addons can no longer use .ts in app, because an addon's app directory gets merged with and uses the host's (i.e. the other addon or app's) preprocessors, and we cannot guarantee the host has TS support. Note that .ts will continue to work for in-repo addons because the app build works with the host's (i.e. the app's, not the addon's) preprocessors.

  • Similarly, apps must use .js to override addon defaults in app, since the different file extension means apps no longer consistently "win" over addon versions (a limitation of how Babel + app merging interact).

Account for TS → Babel issues

ember-cli-typescript v2 uses Babel to compile your code, and the TypeScript compiler only to check your code. This makes for much faster builds, and eliminates the differences between Babel and TypeScript in the build output that could cause problems in v1. However, because of those differences, you’ll need to make a few changes in the process of upgrading.

  • const enum is not supported at all. You will need to replace all uses of const enum with simply enum or constants.

  • Using ES5 getters or setters with this type annotations is not supported through at least Babel 7.3. However, they should also be unnecessary with ES6 classes, so you can simply remove the this type annotation.

  • Trailing commas after rest function parameters (function foo(...bar[],) {}) are disallowed by the ECMAScript spec, so Babel also disallows them.

  • Re-exports of types have to be disambiguated to be types, rather than values. Neither of these will work:

    export { FooType } from 'foo';
    import { FooType } from 'foo';
    export { FooType };

    In both cases, Babel attempts to emit a value export, not just a type export, and fails because there is no actual value to emit. You can do this instead as a workaround:

    import * as Foo from 'foo';
    export type FooType = Foo.FooType;

Getting Help

When seeking help, you should first consider what you need, and which aspect of the Ember+TypeScript ecosystem your issue pertains to.

💬 Getting Started

We have a channel (#topic-typescript) on the Ember Community Discord server where you can ask about getting started, good resources for self-directed learning and more.

📚 Issues With Ember Type Definitions

If you've found that some of the Ember type information is missing things, or is incorrect in some way, please first ensure you're using the latest version of the packages this addon installs. Although StackOverflow and Discuss are not the advised places to report problems, you may find an answer there.

If you don't find an answer, please open an enhancement request or bug report in this project.

⚙️ Issues With Adding TypeScript Support To Apps and Addons

If you run into a problem with the way TypeScript is compiled in Ember apps (i.e., a broccoli error message, incorrect build output, etc...), please first check StackOverflow and Discuss, as you may find an answer.

If you don't find an answer, please open an enhancement request or bug report in this project.

✅ Issues With Linting TypeScript

The TypeScript compiler does some very basic linting of your code, but most developers use (and Microsoft now officially recommends) ESLint.

One sure way to tell which tool is generating an error message is that Linters like ESLint or TSLint will always mention their name, and the name of the pertinent rule, when it alerts you to a violation.

For example, in VS Code, you might see a popover with this message:

[eslint] variable name must be in lowerCamelCase, PascalCase or UPPER_CASE (variable-name)

Here, variable-name is the name of the rule, and [eslint] is the source of the rule.

Supported Ember and TypeScript versions

ember-cli-typescript runs its test suite against Ember CLI current and beta. It's also in active use in several large applications. Any breakage for upcoming releases should be detected and fixed ahead of those releases, but you can help us guarantee that by running your own Ember.js+TypeScript app with beta and canary turned on and let us know if you run into issues with upcoming Ember.js releases.

This library supports the current version of TypeScript TS Version and at least one previous minor or major release. In other words, if 3.4 is the latest release, we do support 3.4.x, 3.3.x, and might support 3.2.x as well. (The test suite only runs against the current release and next branch, but the TS versions do not affect the build process in the same way they do type definitions.)

Installing from git

This addon uses TypeScript for its own implementation, so if you install ember-cli-typescript from git rather than from the npm registry, you won't get compiled .js files. To get everything working, you can install ts-node as a project dependency, and ember-cli-typescript will ensure it's registered correctly to transpile source files as needed.

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

[5.3.0] - 2024-03-05

Changed 💥

Added ⭐️

Fixed 🔧

  • #1537 Airlift updatePathsForAddon from the blueprints package (@dfreeman)

Under the hood 🚗

5.2.1 - 2022-10-26

Fixed 🔧

  • Add back missing function expected from ember-cli-typescript-blueprints #1537, (@dfreeman)

5.2.0 - 2022-10-25

Added ⭐️

Fixed 🔧

  • Fix import/newline-after-import lint violation in global.d.ts (#1520), @bmish
  • Fix no-use-before-define lint violation in environment.d.ts (#1521), @bmish

Documentation 📖

  • Update testing.md to refer to ember-cli-htmlbars instead of ember-cli-htmlbars-inline-precompile (#1517), @ChristopheTiet
  • docs: use prepack and postpack instead of prepublishOnly and postpublish (#1527), @bertdeblock
  • Reflect the introduction of Component Signatures (#1530), @rooman

Under the hood 🚗

5.1.1 - 2022-09-06

Fixed 🔧

  • Use ember-cli-htmlbars rather than htmlbars-inline-precompile in blueprints (#1519)
  • Fix import/newline-after-import lint violation in global.d.ts (#1520)
  • Fix no-use-before-define lint violation in environment.d.ts (#1521)
  • Add @types/ember to installed packages from blueprint (#1508)
  • Update blueprint to use @tsconfig/ember (#1507)
  • Clarify babel version error message (#1500)

Documentation 📖

  • Update discord channel name, fix typos (#1506)
  • Fix spelling resolveable -> resolvable (#1504)

5.1.0 - 2021-04-20

Added ⭐️

  • Update tsconfig and corresponding docs (#1488)

Fixed 🔧

  • Ignore no-empty-interface in the default app index.d.ts (#1484)

Documentation 📖

  • docs: Remove references to DS and DS imports. (#1483)
  • Encourage the use of type-only imports (#1485)
  • typo: comment should be pluralized. (#1489)
  • docs: fix typos (#1490)
  • docs: Add link to transforms page (#1491)

5.0.0 - 2021-02-04

Changed 💥

This now requires Node 12+! That's the only technically breaking change.

  • Update types & ember to 4.x(#1472)

Fixed 🔧

  • Fix type of locationType for Ember v4 (#1466)
  • fix: Use moduleName() to determine addon's referenced name. (#1476)

Documentation 📖

  • docs: fix links to tsconfig.json blueprint (#1445)
  • ember-test-helpers -> @ember/test-helpers (#1473)

Under the hood 🚗

  • Update .npmignore to ignore .github and test folders (#1460)

4.2.1 - 2021-06-17

This is a republish of 4.2.0 without the accidentally included 500+ MB of debugging copies of node_modules.

4.2.0 - 2021-06-15

Added ⭐️

  • Install @types/ember-data__* when ember-data is found (#1411)

Changed 💥

  • update option noEmitOnError to true (#1415)

Documentation 📖

  • Update Broccoli URL (#1409)
  • Improve sentence about declare modifier (#1414)
  • Link to decorator usage doc from ED-models doc (#1404)
  • Fix link to doc "working with route models" (#1418)
  • Fix typo [in services docs] (#1421)
  • @ember-data/object is not a thing (#1429)
  • Update README.md (#1425)

Under the hood 🚗

  • Fix qunit types... again (#1401)
  • Rip out commitlint from CI (#1430)
  • CI updates (#1434)
  • Bump y18n from 3.2.1 to 3.2.2 (#1420)
  • Bump underscore from 1.10.2 to 1.13.1 (#1426)
  • Bump handlebars from 4.7.6 to 4.7.7 (#1427)
  • Bump lodash from 4.17.20 to 4.17.21 (#1428)

4.1.0 - 2021-02-03

Added ⭐️

  • Install @types/ember packages separately via blueprint (#1383)

Documentation 📖

  • Octane and much polish and clarification (#935)
  • Fix working with ember outline links (#1394)
  • Docs fixes (#1395)
  • Fix typos in the Ember Routes docs (#1400)

Under the hood 🚗

  • Fix qunit types conflict (#1344)
  • Bump @types/ember-qunit & @types/qunit to resolve types conflict (#1380)
  • Fix commitlint action config (#1388)
  • Dependency updates (4.1.0-deps-bumps)

4.0.0 - 2020-09-02

Breaking 💥

  • Drop support for Node 8 (#1017)
  • Don't configure Babel for TS transpilation (#1018)

Added ⭐️

  • Don't run type-checking middleware when an existing build is used via --path (#1148)

Changed 💥

  • Update tsconfig.json blueprint target value to 2020 (#1108)
  • Use prepack and postpack instead of prepublishOnly and postpublish (#1196)

Fixed 🔧

  • Bring apps closer to type-checking out of the box (#1169)

Under the hood 🚗

  • Upgrade ✨ Prettier ✨ to a version that supports optional chaining and nullish coalescing (#1018)
  • Add test for optional chaining and nullish coalescing (#1018)
  • Add test for class field declaration (#1018)
  • Add RFCs to repo (#1157)
  • Fix description of ts:precompile (#1162)
  • Fix dead link to "packages this addon installs" (#1164)
  • Get CI passing (#1167)
  • Avoid false-positive willTypechecks on Linux (#1198)
  • Dependency updates (4.0.0-deps-bumps, #1191)

Upgrading ⚙️

  • Make sure you are using at least ember-cli-babel@^7.17.0 or your .ts files will be ignored completely!
  • If you are using ember-auto-import, make sure you are using at least ember-auto-import@^1.6.0.
  • Run ember install ember-cli-typescript@^4.0.0 or use your package manager to upgrade to ember-cli-typescript@^4.0.0 directly and skip the blueprint.

4.0.0-rc.1 - 2020-07-14

Added ⭐️

  • Don't run type-checking middleware when an existing build is used via --path (#1148)

Changed 💥

  • Update tsconfig.json blueprint target value to 2020 (#1108)
  • Use prepack and postpack instead of prepublishOnly and postpublish (#1196)

Fixed 🔧

  • Bring apps closer to type-checking out of the box (#1169)

Under the hood 🚗

Upgrading ⚙️

  • Make sure you are using at least ember-cli-babel@^7.17.0 or your .ts files will be ignored completely!
  • If you are using ember-auto-import, make sure you are using at least ember-auto-import@^1.6.0.
  • Run ember install ember-cli-typescript@next or use your package manager to upgrade to ember-cli-typescript@next directly and skip the blueprint.

4.0.0-alpha.1 - 2020-01-18

Breaking 💥

  • Drop support for Node 8 (#1017)
  • Don't configure Babel for TS transpilation (#1018)

Under the hood 🚗

  • Upgrade ✨ Prettier ✨ to a version that supports optional chaining and nullish coalescing (#1018)
  • Add test for optional chaining and nullish coalescing (#1018)
  • Add test for class field declaration (#1018)

3.1.4 - 2020-05-29

Fixed 🔧

  • Use temp dir in project for precompile (#1153)

Under the hood 🚗

3.1.3 - 2020-01-22

Fixed 🔧

  • Issue a warning if we detect a .js/.ts file collision (#1046)

Under the hood 🚗

3.1.2 - 2019-12-14

Fixed 🔧

  • Remove trailing space in the global.d.ts blueprint (#866)
  • Ensure we register Babel plugins with their full path (#946)
  • Ensure errors are emitted when ts:precompile fails (#984)

Under the hood 🚗

3.1.1 - 2019-11-06

Added ⭐️

3.1.0 - 2019-11-06

3.1.0 was a bad release on npm, and was yanked accordingly. See 3.1.1!

3.0.0 - 2019-08-30

Added ⭐️

  • In addons, ember-cli-typescript now installs itself into dependencies regardless of what ember install command you use. #623

Breaking 💥

  • No longer adds the Babel class properties plugin. This is a fix for #707, but it will break against ember-cli-babel versions before 7.7.
  • Removes support in the default blueprint for initializing new Module Unification projects, in line with MU's removal from Ember's roadmap in favor of other directions. Existing MU projects should continue to build and typecheck according to the local tsconfig.json. (#826)
  • Drops support for Node 6.

2.0.2 - 2019-07-05

2.0.1 - 2019-04-10

Fixed 🔧

  • Correctly handles a mismatch between package and addon names (#669)
  • Uses Notion to specify Node and Yarn versions correctly. (#667)

2.0.0 - 2019-03-13

The bullets below comprise a Greatest Hits list of the fixes and additions from 1.x, but the 2.0 release constitutes a ground-up rewrite of how we handle both transpiling and typechecking TypeScript code. For a full guide for upgrading from 1.x to 2.0, see the Upgrade Notes document.

Fixed 🔧

  • We now play nicely with other JS/TS processors, like ember-auto-import (#287)
  • Compilation across projects in monorepos no longer causes tsc to panic (#314)

Added ⭐️

  • Typechecking now occurs off of the main build thread, so the two are no longer in competition for CPU time on multi-core systems.
  • Much nicer formatting for type errors in both the console and browser when running ember serve.
  • TS code is now transpiled by Babel, allowing it to benefit from the same caching and parallelization as JS transpilation, and ensuring consistent language semantics between TS and JS files.

Upgrading ⚙️

See the 2.0 Upgrade Notes for detailed instructions on upgrading from 1.x to 2.0.

Contributors 🙇

Thanks to everyone who opened/discovered an issue we fixed or PR we merged over the course of our 2.0 stabilization process!

  • @acorncom
  • @allenylzhou
  • @alexlafroscia
  • @anmaikul
  • @Bouke
  • @boris-petrov
  • @championswimmer
  • @chriskrycho
  • @dwickern
  • @dfreeman
  • @ef4
  • @Gaurav0
  • @happycollision
  • @jamescdavis
  • @lifeart
  • @mfeckie
  • @mike-north
  • @runspired
  • @simonihmig
  • @theseyi

2.0.0-rc.2 - 2019-01-07

For details on the changes since 1.x, see the 2.0.0-beta.1 release notes.

Fixed 🔧

  • Set --isolatedModules back to false in both precompilation and generated blueprints

Added ⭐️

  • We now warn you nicely if you try to use this in an addon via devDependencies instead of dependencies

Under the hood 🚗

  • Used the same tests commands across providers, so we get the same results

Upgrading ⚙️

For apps:

ember install ember-cli-typescript@next

For addons:

ember install -S ember-cli-typescript@next

Contributors 🙇

Thanks to everyone who opened/discovered an issue we fixed or PR we merged in this release!

  • @alexlafroscia
  • @dfreeman
  • @happycollision

2.0.0-rc.1 - 2018-12-13

What Changed?

For details on the changes since 1.x, see the 2.0.0-beta.1 release notes.

Fixed 🔧

  • Builds no longer hang if a changed TypeScript file did not trigger a TS rebuild (which can happen e.g. if it is not yet imported elsewhere).
  • Type-checking information now properly gets injected into the build pipeline for test builds as well as development and production builds.
  • Declaration maps now have test coverage to make sure they don't break.

Changed 💥

  • The build system now uses the tsconfig.json file's paths key to copy type definitions during precompile, rather than assuming Ember project structure.

Added ⭐️

  • The addon now checks to confirm you're using Ember CLI 3.5+, since the new approach to builds has serious performance problems with a local tmp directory.

Under the hood 🚗

  • Bumped many dependency versions.
  • Set up Azure Pipelines configuration.
  • Updated internals to use TypeScript themselves.

Upgrading ⚙️

ember install ember-cli-typescript@next

Contributors 🙇

Thanks to everyone who opened/discovered an issue we fixed or PR we merged in this release!

  • @mike-north
  • @dfreeman
  • @jamescdavis

2.0.0-beta.3 - 2018-11-02

What Changed?

For details on the changes since 1.x, see the 2.0.0-beta.1 release notes.

Fixed 🔧

  • Ensure consistency with tsc re: class property initialization order (#365)

Upgrading ⚙️

ember install ember-cli-typescript@beta

Contributors 🙇

Thanks to everyone who opened/discovered an issue we fixed or PR we merged in this release!

  • @runspired
  • @dfreeman

2.0.0-beta.2 - 2018-10-26

Fixed

  • Ensure that ember-cli-typescript doesn't interfere with parallelizing the Babel transpilation process (#351)

2.0.0-beta.1 - 2018-10-25

This is a major release with 💥 breaking changes 💥! However, most apps will compile with minimal (or no) changes! 🎉 They'll also tend to compile much faster in many cases. ⚡️

We now use Babel 7's support for TypeScript to build apps and addons. Most of the horrible hacks we had to do before are now gone, and the error outputs you will see for type errors are much nicer as well. (As a particular note, we should work better with ember-auto-import now, since we're just part of the normal Broccoli/Babel pipeline Ember CLI uses.)

THIS IS A BETA! Please test this out in your apps! Please do not use this for your production apps!

Added

  • Much nicer reporting of type errors both in the console and in your browser
  • Type errors now use the "pretty" type error format stabilized in TypeScript 2.9

Changed

  • We now build the application using Babel 7's TypeScript plugin. This has a few important limitations – some of them bugs (linked below); others are conscious decisions on the part of Babel. The changes:

    • const enum types are unsupported. You should switch to constants or regular enums.

    • trailing commas after rest function parameters (function foo(...bar[],) {}) are disallowed by the ECMAScript spec, so Babel also disallows them.

    • re-exports of types have to be disambiguated to be types, rather than values. Neither of these will work:

      export { FooType } from 'foo';
      import { FooType } from 'foo';
      export { FooType };

      In both cases, Babel attempts to emit a value export, not just a type export, and fails because there is no actual value to emit. You can do this instead as a workaround:

      import * as Foo from 'foo';
      export type FooType = Foo.FooType;
    • this types in ES5 getters and setters are do not work (babel/babel#8069)

    • destructuring of parameters in function signatures currently do not work (babel/babel#8099)

    Other bugs you should be aware of:

    • if an enum has a member with the same name as an imported type (babel/babel#8881)
  • ember-cli-typescript must be in dependencies instead of devDependencies for addons, since we now hook into the normal Broccoli + Babel build pipeline instead of doing an end-run around it

  • Addons can no longer use .ts in app, because an addon's app directory gets merged with and uses the host's (i.e. the other addon or app's) preprocessors, and we cannot guarantee the host has TS support. Note that in-repo-addons will continue to work for in-repo addons because of the app build works with the host's (i.e. the app's, not the addon's) preprocessors.

  • Apps need to use .js for overrides in app, since the different file extension means apps no longer consistently "win" over addon versions (a limitation of how Babel + app merging interact) – note that this won’t be a problem with Module Unification apps

Fixed

  • Type errors now show properly in the browser when running tests

1.5.0 - 2018-10-25

Fixed

  • We now provide better user feedback when installing ember-cli-typescript from a git version (i.e. for testing prereleases)
  • Updated to ember-cli-typescript-blueprints so types in generated files correctly match the latest Ember Data types
  • Updated to latest Ember CLI blueprint (as of 3.5.0)

1.4.4 - 2018-10-01

Fixed

  • We no longer claim the absolute highest priority when ember-cli is selecting blueprints (see #323)

1.4.3 - 2018-09-24

Fixed

  • We now correctly clean up the system temp directory we create during builds (see #318)

Changed

  • We reference the Discord channel instead of Slack.
  • [Internal] We enabled writing code for this addon itself in TypeScript.

1.4.2 - 2018-09-06

Fixed

  • Ensure TS blueprints always take precedence over JS ones (#253)

1.4.1 - 2018-09-05

Fixed

  • Avoid warnings in Ember CLI 3.4+ about missing package directories for our in-repo testing addons (#252)

Changed

1.4.0 - 2018-08-07

Fixed

  • Ignore node_modules hoisted above project root (e.g. yarn workspaces)

Added

1.3.4 - 2018-09-24

Fixed

  • We now correctly clean up the system temp directory we create during builds. (Backported from 1.4.3; see #318.)

1.3.3 - 2018-07-19

Fixed

  • Watcher has been "de-simplified" to make it more consistent with how tsc's own watcher works and prevent rebuild issues.
  • ember-cli-typescript will now run after ember-decorators, ensuring that the ember-cli-typescript blueprints override ember-decorators'.

Changed

  • Improved documentation regarding service injection.

Added

  • Getting Help section to readme.
  • Github issue templates.

1.3.2 - 2018-06-05

Fixed

  • TypeScript 2.9 no longer causes infinite error loops and/or fails to trigger rebuilds.

1.3.1 - 2018-05-14

Fixed

  • No longer requires TypeScript before it has been installed.
  • Properly ignore the root across platforms.

1.3.0 - 2018-05-01

Fixed

  • Simplified the file watching implementation, fixing some odd behavior when trees of files were deleted or moved all at once.
  • Synchronization between tsc and the broccoli build process has been improved, reducing spurious rebuilds.
  • TypeScript no longer churns on every change in the tmp directory.
  • Make sure ember-cli-typescript is a dev dependency when generating in-repo-addons, so their TypeScript gets built correctly.
  • Eliminated some lint errors in the build.

Changed

  • Updated the generated tsconfig.json to use the maximum strictness we can with Ember's typings.
  • Clarified instructions for sourcemaps.

Added

  • The addon now supports failing the build when there are type errors, using "noEmitOnError": true in tsconfig.json.

[1.2.2] - 2018-09-24

Fixed

  • We now correctly clean up the system temp directory we create during builds. (Backported from 1.4.3; see #318.)

1.2.1 - 2018-03-14

Fixed

  • Blueprint now correctly adds ember-cli-typescript as a dependency, allowing TS to be merged into the regular app tree.

1.2.0 - 2018-03-05

Added

  • Blueprint (and tests) to generate in-repo addons configured for TypeScript
  • Add // @ts-ignore component template import.
  • -addon blueprints for all the things to generate .ts files in app/ in an addon.

Changed

Fixed

  • Addon components need to manually set their layout property to the imported compiled template.
  • The declaration file for the <app-name>/config/environment module now resolves correctly from app code. If you have a version of this file previously generated at types/<app-name>/config/environment.d.ts, you'll likely want to move it to app/config/environment.d.ts.

1.1.7 - 2018-09-24

Fixed

  • We now correctly clean up the system temp directory we create during builds. (Backported from 1.4.3; see #318.)

1.1.6 - 2018-02-23

Fixed

  • The blueprints provided by ember-cli-typescript now deterministically override the base ones from ember-data and ember-source.
  • Correct type declarations are installed out of the box based on what test framework is present.
  • A catch-all model registry is generated on installation to avoid the "error TS2344" problem.

1.1.5 - 2018-02-20

Fixed

  • Fixed a regression in 1.1.4 which caused in-repo-addons written in TypeScript not to work correctly.
  • Fixed the tsconfig.json blueprint to properly include the types directory.

1.1.4 - 2018-02-20

Changed

  • The default tsconfig.json now includes inline source maps to support integrating with Babel sourcemaps, and the README has instructions for configuring Ember CLI's Babel integration.

Fixed

  • TypeScript files in addon app trees now get compiled properly.
  • App files now correctly take precedence over any files of the same name earlier in the tree. (If you had a component with the same name as an addon-supplied component, for example, the addon version could override yours.)

1.1.3 - 2018-02-16

Fixed

  • Fix default blueprint for types/<my app>/index.d.ts: add missing import and an export statement so ambient declarations work.
  • Add types to initializer and instance initializer blueprints.
  • Special-case handling for Mirage so that it works at all, and update generators so it works "out of the box".
  • Stop assuming the ember-cli-qunit version consumers have installed will be sufficiently high for our tests to pass.

1.1.2 - 2018-02-13

Fixed

  • Actually resolve the problem of throwing when running generators if ember-cli-version-checker version too low: put it in dependencies.

1.1.1 - 2018-02-12

Fixed

  • No longer throw when running generators if ember-cli-version-checker version too low by putting it in peerDependencies.
  • Clarified some parts of the README that misled people on handling certain errors.

1.1.0 - 2018-02-12

Added

  • Generators: ember generate <blueprint> now creates TypeScript files for you
  • Support for addons: we now precompile addon TypeScript so ember-cli-typescript and typescript itself can remain in devDependencies instead of dependencies, and addons can easily distribute compiled JavaScript with TypeScript type definition (.d.ts) files.
  • Incremental compilation: ember serve or ember test --serve now use TypeScript's tsc --watch mode to only rebuild what changed, so your builds should be much faster

Fixed

  • tsconfig.json is no longer so annoyingly temperamental; you can largely do what you want with it
  • ember serve no longer triggers a full rebuild of all TypeScript files every time any file in your project changes.

1.0.6 - 2017-12-17

Changed

  • Update to broccoli-typescript-compiler 2.1.1, for proper support for TS 2.6. This should make your build properly respect things like // @ts-ignore special comments.

1.0.5 - 2017-11-23

Fixed

  • Updated the tsconfig.json blueprint to set the noImplicitThis option to true, improving experience around use of updated type definitions

1.0.4 - 2017-11-13

Changed

  • Updated broccoli-compiler-typescript
  • Updated package.json to always install latest version of type definitions

Fixed

  • Fixed the default generated environment.d.ts

Internal

1.0.3 - 2017-08-22

Changed

  • TS info messages now go to stdout and TS error messages now properly go to stderr
  • Fixed a dead link in the README

1.0.2 - 2017-08-16

Fixed

  • Updates the generated tsconfig.json to set "modules": "ES6" in the compiler options, so that codemods which operate on modules, like babel-plugin-ember-modules-api-polyfill, will actually work. (Yes, this is 1.0.1, but done correctly.)

1.0.1 - 2017-08-16

Changed

  • Updates the generated tsconfig.json to set "modules": "ES6" in the compiler options, so that codemods which operate on modules, like babel-plugin-ember-modules-api-polyfill, will actually work.

1.0.0 - 2017-08-08

Added

  • Include more type definitions in the default blueprint
  • Documentation of using paths (thanks @toranb!)
  • Supports in-repo addons, including in-repo Ember Engines

Changed

  • Update to broccoli-compiler-typescript@2.0
  • Update Ember CLI and TypeScript (thanks @mfeckie!)
  • Match the broccoli-typescript-compiler option throwOnError with the tsconfig.json noEmitOnError option.

Fixed

  • Use this.ui.write instead of console.log.
  • Only process the tsconfig file once, instead of for every Broccoli tree (i.e. addons, the app, and the tests).
  • No longer pass the allowJs option to TypeScript, since Broccoli manages the tree so .ts and .js files for us.

Internal

  • Run prettier on the codebase

0.4.0 - 2017-05-03

Changed

  • Updated the base type definitions in app/config/environment.d.ts to include the defaults generated when creating an Ember app (thanks, @luketheobscure!)
  • Updated the README with clearer installation instructions and notes on using the add-on to develop other add-ons

Fixed

  • ember serve and ember test and ember build all work properly now, across platforms
  • builds are much faster on all platforms.

0.3.2 - 2017-04-22

Fixed

  • Now properly installs on Windows.

0.3.1 - 2017-04-22

Added

  • tsconfig.json blueprint now includes paths to resolve default Ember app structure imports

Fixed

  • Resolved install bugs on macOS and Linux

Removed

  • All references to local-types in the codebase and blueprints, since local-types is not used by the addon and not a normal TypeScript file location

0.3.0 - 2017-03-13

Fixed

  • tsconfig.json blueprint now works for both the addon and editors

0.2.0 - 2016-12-17

Added

  • Everything; the 0.2.0 release began by copying the implementation from ember-cli-typify.
  • Basic, semi-working functionality.