const keyOptions = ["name", "gender", "address"] as const; type TCustomKeys = { [key in typeof keyOptions[number]]: any }; const obj: TCustomKeys = { name: "James", gender: "M", address: "1 First Rd" }; // no errors, and intellisense working