I have a list of available keys that are allowed on an object, this is a very simple example of what I'm trying to achieve (i don't even know if it's possible)
type AvailableKeys = 'fontSize' | 'skip' | 'something';
interface Param {
key: AvailableKeys;
}
const options: Param[] = [{
key: 'fontSize',
}, {
key: 'skip',
}]
type UsedKeys = typeof options[number]['key'];
What I'm after, is for UsedKeys to be the filtered version of AvailableKeys that were used in the options array, eg if i were to define this manually:
type UsedKeys = 'fontSize' | 'skip';
I've tried a bunch of different things but can't seem to achieve it, any help would be great!