Skip to content

Commit 70562af

Browse files
committed
レビュー修正
1 parent 6797833 commit 70562af

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

docs/4-advanced/03-typescript/index.mdx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,22 @@ function add(a: number, b: number): number {
9696
let sum: number = add(3, 4);
9797
```
9898

99-
型が指定された箇所に、**その型に属さない値が指定される可能性のある**プログラムに対し、TypeScriptはエラーを出力します。例えば、次のプログラムにおいて、`"7"``"3"``"4"``number`型に属さないため、エラーが出力されます。
99+
変数、関数の引数、戻り値など、**値の型が定まっている位置に異なる型の値が入る可能性がある**プログラムを検出すると、TypeScriptはエラーを報告します。例えば、次のプログラムにおいて、`"7"``"3"``"4"``number`型に属さないため、エラーが出力されます。
100100

101101
```typescript
102102
sum = "7"; // Type 'string' is not assignable to type 'number'.
103103

104104
add("3", "4"); // Argument of type 'string' is not assignable to parameter of type 'number'.
105105
```
106106

107-
TypeScriptでは、`number`のほかにも、次の表に示すように、さまざまなデータ型が用意されています。
107+
TypeScriptでは、`number`型のほかにも、次の表に示すように、さまざまなデータ型が用意されています。
108108

109-
| 型名 | 説明 | |
110-
| --------- | ------------ | ------------------------------- |
111-
| `number` | 数値 | `0`, `3.14`, `-7` |
112-
| `string` | 文字列 | `"Hello"`, `"TypeScript"` |
113-
| `boolean` | 真偽値 | `true`, `false` |
114-
| `object` | オブジェクト | `{ name: "田中" }`, `[1, 2, 3]` |
109+
| 型名 | 説明 ||
110+
| --------- | ------------ | ------------------------- |
111+
| `number` | 数値 | `0`, `3.14`, `-7` |
112+
| `string` | 文字列 | `"Hello"`, `"TypeScript"` |
113+
| `boolean` | 真偽値 | `true`, `false` |
114+
| `object` | オブジェクト | `{ name: "田中" }` |
115115

116116
### 確認問題
117117

@@ -277,7 +277,7 @@ function calculateTotal(item, quantity) {
277277
}
278278

279279
const book = {
280-
name: "TypeScript 入門",
280+
name: "TypeScript入門",
281281
price: 2500,
282282
author: "山田 太郎",
283283
};
@@ -296,7 +296,7 @@ function calculateTotal(item: Product, quantity: number): number {
296296
}
297297

298298
const book: Book = {
299-
name: "TypeScript 入門",
299+
name: "TypeScript入門",
300300
price: 2500,
301301
author: "山田 太郎",
302302
};

0 commit comments

Comments
 (0)