I have the following object:
const foo = {
fieldAnt: "foo",
fieldCab: "baz"
};
I'd like to automatically map that to a type with the keys made to uppercase and underscored:
type FIELDS = {
FIELD_ANT: "fieldAnt",
FIELD_CAB: "fieldCab"
}
Is it possible using keyof
or type mapping to programmatically achieve this with typescript?