Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "generics"

Index

Type aliases

Constructor

Constructor<T>: {}

コンストラクタ型。

Type parameters

  • T: {} = {}

Type declaration

ExtractPropertyNames

ExtractPropertyNames<T, U>: {}[keyof T] & string | number

与えられたオブジェクトの特定の型のプロパティのプロパティ名のユニオン型。

例:

x: ExtractPropertyNames<{ a: number; b: number; c: string }, number>

とすると x の型は "a" | "b" になる。

symbol 型をインデックスに用いることができない設定(?)のため、 & (string | number) とすることで symbol 型を排除している。

Key words:

  • Mapped Types
  • keyof Type Operator
  • Indexed Access Types
  • Conditional Types

Reference:

Type parameters

  • T

  • U

Generated using TypeDoc