Skip to content

Commit d62296d

Browse files
committed
Further clarify TS2344 workaround, include in outline.
1 parent 7d230e6 commit d62296d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Use TypeScript in your Ember 2.x and 3.x apps!
1919
* [Service and controller injections](#service-and-controller-injections)
2020
* [Ember Data lookups](#ember-data-lookups)
2121
* [Opt-in unsafety](#opt-in-unsafety)
22+
* [Fixing the Ember Data `error TS2344` problem](#fixing-the-ember-data-error-ts2344-problem)
2223
* [Type definitions outside `node_modules/@types`](#type-definitions-outside-node_modulestypes)
2324
* [ember-browserify](#ember-browserify)
2425
* ["TypeScript is complaining about multiple copies of the same types"](#typescript-is-complaining-about-multiple-copies-of-the-same-types)
@@ -371,18 +372,19 @@ node_modules/@types/ember-data/index.d.ts(920,56): error TS2344: Type 'any' does
371372

372373
This happens because the types for Ember's _test_ tooling includes the types for Ember Data because the `this` value in several of Ember's test types can include a reference to `DS.Store`.
373374

374-
**The fix:** add a declaration like this in your `types` directory:
375+
**The fix:** add a declaration like this in a new file named `ember-data.d.ts` in your `types` directory:
375376

376377
```ts
377-
// types/ember-data.d.ts
378378
declare module 'ember-data' {
379379
interface ModelRegistry {
380380
[key: string]: any;
381381
}
382382
}
383383
```
384384

385-
(If you're developing an addon and concerned that this might affect consumers, it won't. Your types directory will never be referenced by consumers at all!)
385+
This works because (a) we include things in your types directory automatically and (b) TypeScript will merge this module and interface declaration with the main definitions for Ember Data from DefinitelyTyped behind the scenes.
386+
387+
If you're developing an addon and concerned that this might affect consumers, it won't. Your types directory will never be referenced by consumers at all!
386388

387389
### Type definitions outside `node_modules/@types`
388390

0 commit comments

Comments
 (0)