type Obj = {
name: string
age: number
}
type ObjString = Record<keyof Obj, string | null>
const a: ObjString = { name: "kenji", age: 88 }
// Type 'number' is not assignable to type 'string | null'.
- mapped type, `T[keyof T]
type T = {
name: string
age: number
job: never
}
type Type2 = T[keyof T]
//Type2 is "string" | "number"