Skip to content

Commit f18f399

Browse files
committed
README slight restructure.
1 parent 4a0dac5 commit f18f399

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ Use TypeScript in your Ember 2.x and 3.x apps!
99
* [Ember Support](#ember-support)
1010
* [`tsconfig.json`](#tsconfigjson)
1111
* [Incremental adoption](#incremental-adoption)
12-
* [Environment configuration typings](#environment-configuration-typings)
1312
* [Using ember-cli-typescript with Ember CLI addons](#using-ember-cli-typescript-with-ember-cli-addons)
1413
* [Publishing](#publishing)
1514
* [Linking Addons](#linking-addons)
1615
* [Gotchas](#gotchas)
1716
* [Using TypeScript with Ember effectively](#using-typescript-with-ember-effectively)
17+
* [Environment configuration typings](#environment-configuration-typings)
1818
* [Service and controller injections](#service-and-controller-injections)
1919
* [Opt-in unsafety for Ember Data lookups](#opt-in-unsafety-for-ember-data-lookups)
2020
* [Type definitions outside `node_modules/@types`](#type-definitions-outside-node_modulestypes)
@@ -87,10 +87,6 @@ You may also find the blog series ["Typing Your Ember"][typing-your-ember] helpf
8787

8888
[typing-your-ember]: http://www.chriskrycho.com/typing-your-ember.html
8989

90-
## Environment configuration typings
91-
92-
Along with the @types/ files mentioned above, ember-cli-typescript adds a starter interface for `config/environment.js` in `config/environment.d.ts`. This interface will likely require some changes to match your app.
93-
9490
## Using ember-cli-typescript with Ember CLI addons
9591

9692
During development, your `.ts` files will be watched and rebuilt just like any other sources in your addon when you run `ember serve`, `ember test`, etc.
@@ -143,7 +139,11 @@ In addition to the points made below, you may find the "Update" sequence in the
143139

144140
[pt4]: http://www.chriskrycho.com/2018/typing-your-ember-update-part-4.html
145141

146-
## Service and controller injections
142+
### Environment configuration typings
143+
144+
Along with the @types/ files mentioned above, ember-cli-typescript adds a starter interface for `config/environment.js` in `config/environment.d.ts`. This interface will likely require some changes to match your app.
145+
146+
### Service and controller injections
147147

148148
Ember does service and controller lookups with the `inject` helpers at runtime, using the name of the service or controller being injected up as the default value—a clever bit of metaprogramming that makes for a nice developer experience. TypeScript cannot do this, because the name of the service or controller to inject isn't available at compile time in the same way. This means that if you do things the normal Ember way, you will have to specify the type of your service or controller explicitly everywhere you use it.
149149

@@ -230,7 +230,7 @@ You'll need to add that module and interface declaration to all your existing se
230230

231231
If you have a reason to fall back to just getting the `Service` or `Controller` types, you can always do so by just using the string-less variant: `service('session')` will check that the string is a valid name of a service; `session()` will not.
232232

233-
## Opt-in unsafety for Ember Data lookups
233+
### Opt-in unsafety for Ember Data lookups
234234

235235
The same basic approach is in play for Ember Data lookups. As a result, once you add the module and interface definitions for each model, serializer, and adapter in your app, you will automatically get type-checking and autocompletion and the correct return types for functions like `findRecord`, `queryRecord`, `adapterFor`, `serializerFor`, etc. No need to try to write out those (admittedly kind of hairy!) types; just write your Ember Data calls like normal and everything _should_ just work.
236236

0 commit comments

Comments
 (0)