I am new to Typescript and I am not sure about the syntax. I tried searching online but didn't find anything helpful.
These are my interfaces and enum definitions.
interface Products {
asian: {[key: string]: string};
american: {[key: string]: string};
}
enum State {
NEWYORK = 'nyc',
BOSTON = 'boston'
}
interface Branch {
nyc: {
products: Products;
};
boston: {
products: Products;
};
}
I am not sure how to use the Enum State inside Branch interface. So that I can use STATE.NEWYORK and STATE.BOSTON Enums.
Something like this:
interface Branch {
State.NEWYORK: {
products: Products;
};
STATE.BOSTON: {
products: Products;
};
}
Thanks for reading.
Branchor make sure the field is of typeEnumnyc: State.NEWYORK