Skip to content

Commit 3f01b15

Browse files
authored
Merge branch 'master' into de-simplify-watcher
2 parents 5c233d1 + 1dfb156 commit 3f01b15

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

README.md

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ Use TypeScript in your Ember 2.x and 3.x apps!
2525
* [Fixing the Ember Data `error TS2344` problem](#fixing-the-ember-data-error-ts2344-problem)
2626
* [Class property setup errors](#class-property-setup-errors)
2727
* [Type definitions outside `node_modules/@types`](#type-definitions-outside-node_modulestypes)
28-
* [ember-browserify](#ember-browserify)
2928
* [ember-cli-mirage](#ember-cli-mirage)
3029
* ["TypeScript is complaining about multiple copies of the same types"](#typescript-is-complaining-about-multiple-copies-of-the-same-types)
3130
* [Just tell me how to fix it](#just-tell-me-how-to-fix-it)
@@ -425,45 +424,28 @@ If you're developing an addon and concerned that this might affect consumers, it
425424

426425
Some common stumbling blocks for people switching to ES6 classes from the traditional EmberObject setup:
427426

428-
`Assertion Failed: InjectedProperties should be defined with the inject computed property macros.` – You've written `someService = inject()` in an ES6 class body in Ember 3.1+. Replace it with the `.extend` approach or using decorators (`@service` or `@controller`) as discussed [above](#service-and-controller-injections). Because computed properties of all sorts, including injections, must be set up on a prototype, *not* on an instance, if you try to use [class properties] to set up injections, computed properties, the action hash, and so on, you will see this error.
427+
- `Assertion Failed: InjectedProperties should be defined with the inject computed property macros.` – You've written `someService = inject()` in an ES6 class body in Ember 3.1+. Replace it with the `.extend` approach or by using decorators (`@service` or `@controller`) as discussed [above](#service-and-controller-injections). Because computed properties of all sorts, including injections, must be set up on a prototype, *not* on an instance, if you try to use class properties to set up injections, computed properties, the action hash, and so on, you will see this error.
429428

430429
- `Assertion Failed: Attempting to lookup an injected property on an object without a container, ensure that the object was instantiated via a container.` – You failed to pass `...arguments` when you called `super` in e.g. a component class `constructor`. Always do `super(...arguments)`, not just `super()`, in your `constructor`.
431430

432431
### Type definitions outside `node_modules/@types`
433432

434-
By default the typescript compiler loads up any type definitions found in `node_modules/@types`. If the type defs you need are not found here you can register a custom value in `paths` in the `tsconfig.json` file. For example, if you are using [True Myth], you'll need to follow that project's installation instructions (since it ships types in a special location to support both CommonJS and ES Modules):
435-
436-
[true myth]: https://github.com/chriskrycho/true-myth
437-
438-
```json
439-
{
440-
"compilerOptions": {
441-
"paths": {
442-
"my-app-name/*": ["app/*"],
443-
"true-myth/*": ["node_modules/true-myth/dist/types/src/*"]
444-
}
445-
}
446-
}
447-
```
448-
449-
### ember-browserify
450-
451-
If you're using [ember-browserify], you're used to writing imports like this:
433+
By default, the TypeScript compiler loads all type definitions found in `node_modules/@types`. If the type defs you need are not found there and are not supplied in the root of the package you're referencing, you can register a custom value in `paths` in the `tsconfig.json` file. For example, if you're using [ember-browserify], you're used to writing imports like this:
452434

453435
[ember-browserify]: https://github.com/ef4/ember-browserify
454436

455437
```js
456438
import MyModule from 'npm:my-module';
457439
```
458440

459-
If the `my-module` has types, you will not be able to resolve them this way by default. You can add a simple tweak to your `tsconfig.json` to resolve the types correctly, however:
441+
If `my-module` has types, you will not be able to resolve them this way by default. You can add a simple tweak to your `tsconfig.json` to resolve the types correctly, however, mapping `npm:*` to `node_modules/*`.
460442

461443
```json
462444
{
463445
"compilerOptions": {
464446
"paths": {
465447
"my-app-name/*": ["app/*"],
466-
"npm:my-module/*": ["node_modules/my-module/*"]
448+
"npm:*": ["node_modules/*"]
467449
}
468450
}
469451
}

0 commit comments

Comments
 (0)