Is it possible to mandate the keys of an interface to come from an array of strings:
For instance, consider the following array:
const myArray = ['key1', 'key2'];
I aim to define a new interface named MyInterface
that would require all entries in myArray
to be used as keys in an object:
const myObj: MyInterface = {
'key1': true,
'key2': false,
}