You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The keyof operator takes an object type and produces a string or numeric literal union of its keys. The following type P is the same type as type P = "x" | "y":
以下の説明は間違っていると考えます。ユニオン型は型の和集合であり、値の和集合ではありません。
これはTypescript HandbookのKeyof Type Operatorを参考にしたと思われます。
しかし、ここでいうunionは「ユニオン型」ではなく「和集合」と考えるべきです。つまり、
と解釈すべきです。この文章はプログラム言語の解説としてはあいまいですが、「 keyof 演算子はオブジェクト型をうけとり、そのキーから文字列か数のリテラル型を作ります」と理解するのが妥当だと考えます。
ですので、冒頭の解説も
と変更すべきです。
The text was updated successfully, but these errors were encountered: