I have an interface:
interface Example {
foo: boolean
bar: boolean
}
And I'd like a type that matches ['foo', 'bar']
I've tried
type Keys = (keyof Example)[]
This matches an empty array, as it doesn't require all of the keys, just partial.
Is there a way to do this?
If this isn't possible? Is it possible to require a type to have all items in the array?
const shouldFail = ['foo']
const shouldPass = ['foo', 'bar']