I have an object
const modalTypes = {
newPizza: 'NEW_PIZZA',
newCola: 'NEW_COLA',
newCustom: 'NEW_CUSTOM,
}
Then I have an action creator that takes an action that is one of the modalTypes' values.
const showModal = (modalType: ModalType, body: BodyType) => {
// do something...
}
// e.g.
showModal('NEW_PIZZA', ...)
How to get the ModalType to be NEW_PIZZA | NEW_COLA | NEW_CUSTOM?
Something similar to this, but for values.
const Foo = { a: 'FOO', b: 'BAR', c: 'BAZ' };
type Abc = keyof typeof Foo
Abc = 'a' | 'b' | 'c'
// Desired = 'FOO' | 'BAR' | 'BAZ'
stringrather than literals like'NEW_PIZZA'. I think an emum may work best here if you could make that change.