-
Notifications
You must be signed in to change notification settings - Fork 3
TypeScript の節の充実化 #887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript の節の充実化 #887
Conversation
Deploying utcode-learn with
|
| Latest commit: |
1998787
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://83228af3.utcode-learn.pages.dev |
| Branch Preview URL: | https://rewrite-typescript.utcode-learn.pages.dev |
| | 引数の型 | `T` が `U` の部分型 | `(x: U) => R` が `(x: T) => R` の部分型 | | ||
| | 戻り値の型 | `T` が `U` の部分型 | `() => T` が `() => U` の部分型 | | ||
|
|
||
| 戻り値の型については自然に理解できますが、引数の数や引数の型については直感に反するかもしれません。このような関係になっているのは、関数が受け取る引数が少なかったり、より一般的な型であったりする場合、その関数はより多くの状況で安全に使用できるためです。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
型の互換性は難しいですね. 共変と反変を理解していないからか. https://www.typescriptlang.org/docs/handbook/type-compatibility.html
|
|
||
| **問題1**: `string & number`型は何型と等しいでしょうか。 | ||
|
|
||
| **問題2**: 次のように定義される型`T`に対して使用可能なプロパティは何でしょうか。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用可能の意味がはっきりしていない気がしました。
- 型絞り込み(type narrowing)なしで直接アクセス可能という意味なのか
- 何らかの方法で使用可能という意味なのか
type narrowingがないときになどあった方が明確かと思いました。
chvmvd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
難易度の高い内容も増えているので、DocusaurusのAdmonitionsなどの機能を使って、もう少し初めて学習する際の難易度を下げられるといいかなと思います。特に集合の考え方に日頃から慣れ親しんでいないとかなり認知負荷が高い箇所が多いように思います。
| return item.price * quantity; | ||
| } | ||
|
|
||
| const book = new Book("TypeScript 入門", 2500, "山田 太郎"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一般的には、和文文字と欧文文字間には半角スペースを入れないことの方が多いように思います。
cf. https://ndlsearch.ndl.go.jp/books/R100000002-I032089505 https://ndlsearch.ndl.go.jp/search?cs=bib&keyword=TypeScript+%E5%85%A5%E9%96%80
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR restructures and expands the TypeScript documentation, converting it from an exercise-based format to a more comprehensive tutorial with embedded practice problems. The changes improve pedagogical flow by integrating examples and exercises directly into each section.
- Reorganizes content structure by promoting subsections to main sections and integrating exercises inline
- Adds new practice problems with detailed answers throughout the document
- Expands explanations on type relationships, subtyping, and generics with concrete examples
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
補足ですが、特にクラスや関数型の部分型の関係などについては、内容がかなり高度なので削除を検討しても良いように思います。 |
| こういった言語機能は他の多くのプログラミング言語でも用意されており、[ジェネリクス](https://www.typescriptlang.org/docs/handbook/2/generics.html)と呼ばれます。 | ||
|
|
||
| `type`宣言でも型パラメータを利用できます。 | ||
| `type`やクラスでも型パラメータを利用できます。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type=>type宣言?
| `type`宣言を用いると、データ型に対して別名を付けられます。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一箇所のみ少しだけ気になるところはありますが、他は全く問題ないと思います!
TypeScriptの節がかなり読みやすくなったと思います。ありがとうございます。
| こういった言語機能は他の多くのプログラミング言語でも用意されており、[ジェネリクス](https://www.typescriptlang.org/docs/handbook/2/generics.html)と呼ばれます。 | ||
|
|
||
| `type`宣言でも型パラメータを利用できます。 | ||
| `type`やクラスでも型パラメータを利用できます。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chvmvd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
もうコメントできることなさそうです👌
No description provided.