Skip to content

Commit 8ff7057

Browse files
committed
Converted typescript gotchas to use gts
1 parent 41b3e0d commit 8ff7057

File tree

1 file changed

+4
-24
lines changed
  • guides/release/typescript/additional-resources

1 file changed

+4
-24
lines changed

guides/release/typescript/additional-resources/gotchas.md

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,34 +54,11 @@ For examples, see:
5454
- EmberData [`@belongsTo`][model-belongsto]
5555
- EmberData [`@hasMany`][model-hasmany]
5656

57-
## Templates
58-
59-
Templates are currently totally non-type-checked. This means that you lose any safety when moving into a template context, even if using a Glimmer `Component` in Ember Octane. (Looking for type-checking in templates? Try [Glint][]!)
60-
61-
For example, TypeScript won't detect a mismatch between this action and the corresponding call in the template:
62-
63-
```typescript {data-filename="app/components/my-game.ts"}
64-
import Component from '@ember/component';
65-
import { action } from '@ember/object';
66-
67-
export default class MyGame extends Component {
68-
@action turnWheel(degrees: number) {
69-
// ...
70-
}
71-
}
72-
```
73-
74-
```handlebars {data-filename="app/components/my-game.hbs"}
75-
<button {{on 'click' (fn this.turnWheel 'potato')}}>
76-
Click Me
77-
</button>
78-
```
79-
8057
## Hook Types and Autocomplete
8158

8259
Let's imagine a component which just logs the names of its arguments when it is first constructed. First, we must define the [Signature][] and pass it into our component, then we can use the `Args` member in our Signature to set the type of `args` in the constructor:
8360

84-
```typescript {data-filename="app/components/args-display.ts"}
61+
```gts {data-filename="app/components/args-display.gts"}
8562
import Component from '@glimmer/component';
8663
8764
const log = console.log.bind(console);
@@ -99,6 +76,9 @@ export default class ArgsDisplay extends Component<ArgsDisplaySignature> {
9976
super(owner, args);
10077
Object.keys(args).forEach(log);
10178
}
79+
80+
<template>
81+
</template>
10282
}
10383
```
10484

0 commit comments

Comments
 (0)