Skip to content

Commit 99b90fd

Browse files
authored
Remove warnings about types—because we fixed them!
1 parent 7060e95 commit 99b90fd

File tree

1 file changed

+7
-53
lines changed

1 file changed

+7
-53
lines changed

README.md

Lines changed: 7 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -127,52 +127,31 @@ landing in TypeScript itself.
127127
[existing typings]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ember
128128

129129
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]!
134132

135133
[ember-typings]: https://github.com/typed-ember/ember-typings
136134

137135
Here is the short list of things which do *not* work yet in the version of the
138136
typings published on DefinitelyTyped.
139137

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-
146138
### Some `import`s don't resolve
147139

148140
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:
150143

151144
```typescript
152-
import hbs from 'htmlbars-inline-precompile';
145+
import { task } from 'ember-concurrency';
153146
```
154147

155148
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.
158151

159152
Writing these missing type definitions is a great way to pitch in! Jump in
160153
\#topic-typescript on the Ember Slack and we'll be happy to help you.
161154

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-
176155
### Type safety when invoking actions
177156

178157
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:
199178
this.send('turnWheel', 'ALSO-NOT-A-NUMBER');
200179
```
201180

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-
227181
### The type definitions I need to reference are not in `node_modules/@types`
228182

229183
By default the typescript compiler loads up any type definitions found in

0 commit comments

Comments
 (0)