Restricting Object Keys with TypeScript and Autocomplete
I've got this riddle: I'd like to restrict properties of a generic object argument to a subset of a given set of keys, triggering an error if an object literal passed as arg contains keys outside of that set. I've got this solution:
however when typing the keys, I don't get autocomplete for the possible keys (which is essential for the api I'm working on)
The following brings back the auto-complete but I'm not sure if it could cause any unexpected side-effects. And it seems like there should be a simpler way to do this. Any ideas?
however when typing the keys, I don't get autocomplete for the possible keys (which is essential for the api I'm working on)
The following brings back the auto-complete but I'm not sure if it could cause any unexpected side-effects. And it seems like there should be a simpler way to do this. Any ideas?
