@@ -127,52 +127,31 @@ landing in TypeScript itself.
127
127
[ existing typings ] : https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ember
128
128
129
129
We are hard at work (and would welcome your help!) [ writing new
130
- typings] [ ember-typings ] for Ember and the surrounding ecosystem, which can give
131
- correct types for Ember's custom object model and things which build on it (e.g.
132
- ember-data). If you'd like to try those out, please see instructions in [ that
133
- repo] [ ember-typings ] !
130
+ typings] [ ember-typings ] for Ember and the surrounding ecosystem. If you'd like
131
+ to try those out, please see instructions in [ that repo] [ ember-typings ] !
134
132
135
133
[ ember-typings ] : https://github.com/typed-ember/ember-typings
136
134
137
135
Here is the short list of things which do * not* work yet in the version of the
138
136
typings published on DefinitelyTyped.
139
137
140
- ### New modules API
141
-
142
- Note: the new modules API is not yet supported by the official typings (which
143
- are distinct from this addon, though we install them). We do have experimental
144
- support for them in the [ ember-typings] repository, and it works quite well!
145
-
146
138
### Some ` import ` s don't resolve
147
139
148
140
You'll frequently see errors for imports which TypeScript doesn't know how to
149
- resolve. For example, if you use ` htmlbars-inline-precompile ` :
141
+ resolve. For example, if you use Ember Concurrency today and try to import its
142
+ ` task ` helper:
150
143
151
144
``` typescript
152
- import hbs from ' htmlbars-inline-precompile ' ;
145
+ import { task } from ' ember-concurrency ' ;
153
146
```
154
147
155
148
You'll see an error, because there aren't yet type definitions for it. You may
156
- see the same with some addons as well. These won't stop the build from working;
157
- they just mean TypeScript doesn't know where to find those.
149
+ see the same with some addons as well. ** These won't stop the build from
150
+ working; ** they just mean TypeScript doesn't know where to find those.
158
151
159
152
Writing these missing type definitions is a great way to pitch in! Jump in
160
153
\# topic-typescript on the Ember Slack and we'll be happy to help you.
161
154
162
- ### ` extends ` gives errors
163
-
164
- You'll see quite a few errors like this when calling ` .extends() ` on an existing
165
- Ember type:
166
-
167
- > Class 'FooController' incorrectly extends base class 'Controller'.
168
- > Type '{ bar(): void; }' has no properties in common with type 'ActionHash'
169
-
170
- This is a symptom of the current, out-of-date types. The new typings we're
171
- working on will solve these.
172
-
173
- In the meantime, note that your application will still build just fine even with
174
- these errors... they'll just be annoying.
175
-
176
155
### Type safety when invoking actions
177
156
178
157
TypeScript won't detect a mismatch between this action and the corresponding
@@ -199,31 +178,6 @@ Likewise, it won't notice a problem when you use the `send` method:
199
178
this .send (' turnWheel' , ' ALSO-NOT-A-NUMBER' );
200
179
```
201
180
202
- ### Type safety with ` Ember.get ` , ` Ember.set ` , etc.
203
-
204
- When you use ` Ember.get ` or ` Ember.set ` , TypeScript won't yet warn you that
205
- you're using the wrong type. So in ` foo() ` here, this will compile but be
206
- wrong at runtime:
207
-
208
- ``` typescript
209
- Ember .Object .extend ({
210
- urls: <string []> null ,
211
- port: 4200 , // number
212
-
213
- init() {
214
- this ._super (... arguments );
215
- this .set (' urls' , []);
216
- },
217
-
218
- foo() {
219
- // TypeScript won't detect these type mismatches
220
- this .get (' urls' ).addObject (51 );
221
- this .set (' port' , ' 3000' );
222
- },
223
- });
224
- ```
225
-
226
-
227
181
### The type definitions I need to reference are not in ` node_modules/@types `
228
182
229
183
By default the typescript compiler loads up any type definitions found in
0 commit comments