Here's a code snippet I'm working with:
enum Foo {
a,
b,
c
}
type Bar = {
[key in keyof typeof Foo]: string;
}
const test: Bar = {
a: 'a',
b: 'b'
};
I'm encountering an issue where the code is complaining about the missing c
property in the test
variable.
Any suggestions on how to adjust the Bar
type so that the keys from the enum are optional?