Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
38elements committed Dec 8, 2020
1 parent 0b21df6 commit 5856bd8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions content/ja/guide/v10/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class Button extends Component {
handleClick(event: MouseEvent) {
event.preventDefault();
if (event.target instanceof HTMLElement) {
alert(event.target.tagName); // アラートでBUTTONを表示します。
console.log(event.target.tagName); // "BUTTON"
}
}

Expand All @@ -200,8 +200,7 @@ export class Button extends Component {
}
```

You can restrict event handlers by adding a type annotation for `this` to the function signature as the first argument.
This argument will be erased after transpilation.
[this parameters](https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters)を使うと、`EventTarget`の型を指定することができます。

```tsx
export class Button extends Component {
Expand Down

0 comments on commit 5856bd8

Please sign in to comment.