Skip to content

Commit

Permalink
Merge pull request #920 from yytypescript/feature/919
Browse files Browse the repository at this point in the history
feat: 🎸 トップにAwaitedの説明を追加
  • Loading branch information
jamashita authored Oct 25, 2024
2 parents 31d155a + 1fc7575 commit 2ca7646
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1536,7 +1536,7 @@ type T2 = NonNullable<T1>;
// ^?
```

### ReturnType
#### ReturnType

- [`ReturnType`](reference/type-reuse/utility-types/return-type.md)は、関数の戻り値の型を取得するユーティリティ型。

Expand All @@ -1549,6 +1549,20 @@ type StringifyReturnType = ReturnType<typeof stringify>;
// ^?
```

#### Awaited

- [`Awaited`](reference/type-reuse/utility-types/awaited.md)は、Promiseの戻り値の型を取得するユーティリティ型。

```typescript twoslash
const promise1 = Promise.resolve("data");
const promise2 = Promise.resolve(Promise.resolve("data"));

type Data1 = Awaited<typeof promise1>;
// ^?
type Data2 = Awaited<typeof promise2>;
// ^?
```

### Mapped types

- [Mapped types](reference/type-reuse/mapped-types.md)を使うと、既存の型から新しい型を生成できる。
Expand Down

0 comments on commit 2ca7646

Please sign in to comment.