Skip to content

Commit

Permalink
docs: document enableTypeScriptTransforms
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescdavis committed Jan 8, 2020
1 parent 5d7a817 commit ff592d3
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ allow you to use latest Javascript in your Ember CLI project.
+ [Enabling Source Maps](#enabling-source-maps)
+ [Modules](#modules)
+ [Disabling Debug Tooling Support](#disabling-debug-tooling-support)
+ [Enabling TypeScript Transforms](#enabling-typescript-transforms)
* [Addon usage](#addon-usage)
+ [Adding Custom Plugins](#adding-custom-plugins)
+ [Additional Trees](#additional-trees)
Expand Down Expand Up @@ -121,6 +122,7 @@ interface EmberCLIBabelConfig {
disablePresetEnv?: boolean;
disableEmberModulesAPIPolyfill?: boolean;
disableDecoratorTransforms?: boolean;
enableTypeScriptTransforms?: boolean;
extensions?: string[];
};
}
Expand Down Expand Up @@ -259,6 +261,39 @@ module.exports = function(defaults) {
}
```

#### Enabling TypeScript Transforms

The transform plugins required for Babel to transpile TypeScript (including
transforms required for all valid TypeScript features such as optional
chaining and nullish coalescing) will automatically be enabled when
`ember-cli-typescript` >= 4.0 is installed.

You can enable the TypeScript Babel transforms manually *without*
`ember-cli-typescript` by setting the `enableTypeScriptTransforms`to `true`.

NOTE: Setting this option to `true` is not compatible with
`ember-cli-typescript` < 4.0 because of conflicting Babel plugin ordering
constraints and is unnecessary because `ember-cli-typescript` < 4.0 adds the
TypeScript Babel transforms itself.

NOTE: Setting this option does *not* enable type-checking. For integrated
type-checking, you will need [`ember-cli-typescript`](https://ember-cli-typescript.com).

In an app, manually enabling the TypeScript transforms would look like:

```js
// ember-cli-build.js
module.exports = function(defaults) {
let app = new EmberApp(defaults, {
'ember-cli-babel': {
enableTypeScriptTransforms: true
}
});

return app.toTree();
}
```

### Addon usage

#### Adding Custom Plugins
Expand Down

0 comments on commit ff592d3

Please sign in to comment.