|
1 | | -# Configuring ember-cli-typescript |
| 1 | +# Configuration |
2 | 2 |
|
3 | 3 | ## Blueprints |
4 | 4 |
|
5 | | -By default, ember-cli-typescript installs the [ember-cli-typescript-blueprints][blueprints] package so that you can use Ember's generators like normal, but with all the special sauce you need for things to work nicely throughout your system with TypeScript. |
| 5 | +By default, ember-cli-typescript installs the [ember-cli-typescript-blueprints](https://github.com/typed-ember/ember-cli-typescript-blueprints) package so that you can use Ember's generators like normal, but with all the special sauce you need for things to work nicely throughout your system with TypeScript. |
6 | 6 |
|
7 | | -[blueprints]: https://github.com/typed-ember/ember-cli-typescript-blueprints |
8 | | - |
9 | | -If you want to stick with the normal JavaScript blueprints—say, because your team isn't ready to dive into the deep end with making *everything* TypeScript yet—you can simply uninstall the blueprints package. |
| 7 | +If you want to stick with the normal JavaScript blueprints—say, because your team isn't ready to dive into the deep end with making _everything_ TypeScript yet—you can simply uninstall the blueprints package. |
10 | 8 |
|
11 | 9 | With yarn: |
12 | 10 |
|
13 | | -```sh |
| 11 | +```bash |
14 | 12 | yarn remove ember-cli-typescript-blueprints |
15 | 13 | ``` |
16 | 14 |
|
17 | 15 | With npm: |
18 | 16 |
|
19 | | -```sh |
| 17 | +```bash |
20 | 18 | npm uninstall ember-cli-typescript-blueprints |
21 | 19 | ``` |
22 | 20 |
|
23 | 21 | ## `tsconfig.json` |
24 | 22 |
|
25 | | -We generate a good default [`tsconfig.json`][blueprint], which will usually make everything _Just Work™_. In general, you may customize your TypeScript build process as usual using the `tsconfig.json` file. |
| 23 | +We generate a good default [`tsconfig.json`](https://github.com/typed-ember/ember-cli-typescript/blob/master/blueprints/ember-cli-typescript/files/tsconfig.json), which will usually make everything _Just Work™_. In general, you may customize your TypeScript build process as usual using the `tsconfig.json` file. |
26 | 24 |
|
27 | 25 | However, there are a few things worth noting if you're already familiar with TypeScript and looking to make further or more advanced customizations (but _most_ users can just ignore this section!): |
28 | 26 |
|
29 | 27 | 1. The generated tsconfig file does not set `"outDir"` and sets `"noEmit"` to `true`. The default configuration we generate allows you to run editors which use the compiler without creating extraneous `.js` files throughout your codebase, leaving the compilation to ember-cli-typescript to manage. |
30 | 28 |
|
31 | | - You _can_ still customize those properties in `tsconfig.json` if your use case requires it, however. For example, to see the output of the compilation in a separate folder you are welcome to set `"outDir"` to some path and set `"noEmit"` to `false`. Then tools which use the TypeScript compiler (e.g. the watcher tooling in JetBrains IDEs) will generate files at that location, while the Ember.js/[Broccoli] pipeline will continue to use its own temp folder. |
| 29 | + You _can_ still customize those properties in `tsconfig.json` if your use case requires it, however. For example, to see the output of the compilation in a separate folder you are welcome to set `"outDir"` to some path and set `"noEmit"` to `false`. Then tools which use the TypeScript compiler (e.g. the watcher tooling in JetBrains IDEs) will generate files at that location, while the Ember.js/[Broccoli](http://broccolijs.com/) pipeline will continue to use its own temp folder. |
32 | 30 |
|
33 | 31 | 2. Closely related to the previous point: any changes you do make to `outDir` won't have any effect on how _Ember_ builds your application—we run the entire build pipeline through Babel's TypeScript support instead of through the TypeScript compiler. |
34 | | - |
35 | | -3. Since your application is built by Babel, and only *type-checked* by TypeScript, we set the `target` key in `tsconfig.json` to the current version of the ECMAScript standard so that type-checking uses the latest and greatest from the JavaScript standard library. The Babel configuration in your app's `config/targets.js` and any included polyfills will determine the final build output. |
36 | | - |
37 | | -4. If you make changes to the paths included in or excluded from the build via your `tsconfig.json` (using the `"include"`, `"exclude"`, or `"files"` keys), you will need to restart the server to take the changes into account: ember-cli-typescript does not currently watch the `tsconfig.json` file. For more details, see [the TypeScript reference materials for `tsconfig.json`][tsconfig]. |
38 | | - |
39 | | -[blueprint]: https://github.com/typed-ember/ember-cli-typescript/blob/master/blueprints/ember-cli-typescript/files/tsconfig.json |
40 | | -[Broccoli]: http://broccolijs.com/ |
41 | | -[tsconfig]: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html |
| 32 | +3. Since your application is built by Babel, and only _type-checked_ by TypeScript, we set the `target` key in `tsconfig.json` to the current version of the ECMAScript standard so that type-checking uses the latest and greatest from the JavaScript standard library. The Babel configuration in your app's `config/targets.js` and any included polyfills will determine the final build output. |
| 33 | +4. If you make changes to the paths included in or excluded from the build via your `tsconfig.json` (using the `"include"`, `"exclude"`, or `"files"` keys), you will need to restart the server to take the changes into account: ember-cli-typescript does not currently watch the `tsconfig.json` file. For more details, see [the TypeScript reference materials for `tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html). |
42 | 34 |
|
43 | 35 | ## Enabling Sourcemaps |
44 | 36 |
|
45 | 37 | To enable TypeScript sourcemaps, you'll need to add the corresponding configuration for Babel to your `ember-cli-build.js` file: |
46 | 38 |
|
47 | | -```ts |
| 39 | +```typescript |
48 | 40 | const app = new EmberApp(defaults, { |
49 | 41 | babel: { |
50 | 42 | sourceMaps: 'inline', |
|
0 commit comments