const keys = ['channelId', 'memberId'] as const;
const validOptions: Record<..., string[]> = {
channelId: [...],
memberId: [...],
};
In the above code, the keys of validOptions are the elements of keys array. But how do I tell that to typescript? In the above example, I used the Record helper, but really, I am fine with any method as long as it works well