JsTypeScript SnippetTypeScript Snippetkeyof1 2 3 4 5 6 7 8 9 type SettingOptions = { fontSize: number lineHeight: number letterSpacing: number color: `#${string}` backgroundColor: `#${string}` } type OptionKey = keyof SettingOptions // 'fontSize' | 'lineHeight' | 'letterSpacing' ... docs: keyofstatic method of class 1 2 3 4 5 6 7 8 9 10 11 class A { declare propertyA: string declare propertyB: number static build() { let a = new A() a.propertyA = 'default' a.propertyB = '100' return a } } valueof1 2 3 4 5 6 7 const key = { a: 'KEY_A', b: 'KEY_B', } as const type ValueOf<T> = T[keyof T] type Key = ValueOf<typeof key> // type Key = 'KEY_A' | 'KEY_B'