Skip to content

Commit 496fa76

Browse files
committed
docs: remove needless references to ember-decorators
1 parent 3cd77bb commit 496fa76

File tree

7 files changed

+82
-58
lines changed

7 files changed

+82
-58
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ ember install ember-decorators@^3.1.0 @ember-decorators/babel-transforms@^3.1.0
8989

9090
#### Update ember-decorators
9191

92-
Follow the same process of deduplication, reinstallation, and re-deduplication as described for ember-cli-babel above. This will get you the latest version of ember-decorators and, importantly, its @ember-decorators/babel-transforms dependency.
92+
If you're on a version of Ember before 3.10, follow the same process of deduplication, reinstallation, and re-deduplication as described for ember-cli-babel above for ember-decorators. This will get you the latest version of ember-decorators and, importantly, its @ember-decorators/babel-transforms dependency.
9393

9494
#### Update ember-cli-typescript
9595

docs/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* [Installation](installation.md)
55
* [Configuration](configuration.md)
66
* [TypeScript and Ember](ts/README.md)
7-
* [Using TypeScript with Ember effectively](ts/using-ts-effectively.md)
7+
* [Using TypeScript With Ember Effectively](ts/using-ts-effectively.md)
88
* [Decorators](ts/decorators.md)
99
* [Current limitations](ts/current-limitations.md)
1010
* [Building Addons in TypeScript](ts/with-addons.md)

docs/cookbook/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ This “cookbook” section contains recipes for various scenarios you may encou
66
Have an idea for an item that should fit here? [Open an issue for it!](https://github.com/typed-ember/ember-cli-typescript/issues/new/choose) We'd love to help you help us make this experience more awesome for everyone.
77
{% endhint %}
88

9-
* Working with route models
9+
## Contents
10+
11+
* [Working with route models](./working-with-route-models.md)
1012

docs/ts/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,10 @@ This guide covers the common details and "gotchas" of using TypeScript with Embe
66
* [TypeScript Deep Dive](https://basarat.gitbook.io/typescript/)
77
* [Ember docs](https://emberjs.com/learn/)
88

9+
## Outline
10+
11+
* [Using TypeScript With Ember Effectively](using-ts-effectively.md)
12+
* [Decorators](decorators.md)
13+
* [Current limitations](current-limitations.md)
14+
* [Building Addons in TypeScript](with-addons.md)
15+
* [Understanding the Package Names](package-names.md)

docs/ts/current-limitations.md

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
# Current limitations
1+
# Current Limitations
22

33
While TS already works nicely for many things in Ember, there are a number of corners where it _won't_ help you out. Some of them are just a matter of further work on updating the [existing typings](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ember); others are a matter of further support landing in TypeScript itself, or changes to Ember's object model.
44

55
## Some `import`s don't resolve
66

7-
You'll frequently see errors for imports which TypeScript doesn't know how to resolve. For example, if you use Ember Concurrency today and try to import its `task` helper:
8-
9-
```typescript
10-
import { task } from 'ember-concurrency';
11-
```
12-
13-
You'll see an error, because there aren't yet type definitions for it. You may see the same with some addons as well. **These won't stop the build from working;** they just mean TypeScript doesn't know where to find those.
7+
You'll frequently see errors for imports which TypeScript doesn't know how to resolve. **These won't stop the build from working;** they just mean TypeScript doesn't know where to find those.
148

159
Writing these missing type definitions is a great way to pitch in! Jump in `#e-typescript` on the [Ember Community Discord server](https://discord.gg/zT3asNS) and we'll be happy to help you.
1610

@@ -20,29 +14,48 @@ Templates are currently totally non-type-checked. This means that you lose any s
2014

2115
Addons need to import templates from the associated `.hbs` file to bind to the layout of any components they export. The TypeScript compiler will report that it cannot resolve the module, since it does not know how to resolve files ending in `.hbs`. To resolve this, you can provide this set of definitions to `my-addon/types/global.d.ts`, which will allow the import to succeed:
2216

23-
declare module '\*/template' { import { TemplateFactory } from 'htmlbars-inline-precompile';
24-
25-
const template: TemplateFactory; export default template; }
26-
27-
declare module 'app/templates/\*' { import { TemplateFactory } from 'htmlbars-inline-precompile';
17+
```ts
18+
declare module '\*/template' {
19+
import { TemplateFactory } from 'htmlbars-inline-precompile';
20+
const template: TemplateFactory; export default template;
21+
}
2822

29-
const template: TemplateFactory; export default template; }
3023

31-
declare module 'addon/templates/\*' { import { TemplateFactory } from 'htmlbars-inline-precompile';
24+
declare module 'app/templates/\*' {
25+
import { TemplateFactory } from 'htmlbars-inline-precompile';
26+
const template: TemplateFactory; export default template;
27+
}
3228

33-
const template: TemplateFactory; export default template; }
29+
declare module 'addon/templates/\*' {
30+
import { TemplateFactory } from 'htmlbars-inline-precompile';
31+
const template: TemplateFactory; export default template;
32+
}
33+
```
3434

3535
## Invoking actions
3636

3737
TypeScript won't detect a mismatch between this action and the corresponding call in the template:
3838

39-
import Component from '@ember/component'; import { action } from '@ember-decorators/object';
39+
```ts
40+
import Component from '@ember/component';
41+
import { action } from '@ember/object';
4042

41-
export default class MyGame extends Component { @action turnWheel\(degrees: number\) { // ... } }
43+
export default class MyGame extends Component {
44+
@action turnWheel(degrees: number) {
45+
// ...
46+
}
47+
}
48+
```
4249

50+
```hbs
51+
<button {{on "click" (fn this.turnWheel "potato")}}>
4352
Click Me
53+
</button>
54+
```
4455

4556
Likewise, it won't notice a problem when you use the `send` method:
4657

47-
// TypeScript compiler won't detect this type mismatch this.send\('turnWheel', 'ALSO-NOT-A-NUMBER'\);
48-
58+
```ts
59+
// TypeScript compiler won't detect this type mismatch
60+
this.send\('turnWheel', 'ALSO-NOT-A-NUMBER'\);
61+
```

0 commit comments

Comments
 (0)