I have array: const arr = ['foo', 'bar', 'bax'];
I want to create an object based on array entries:
const obj = {
foo: true,
bar: true,
bax: false,
fax: true, // typescript should show error here because "fax" is not in "arr"
};
How to tell typescript that all keys of obj
must be inside arr
?