I currently have both an array of strings and a string literal union type containing the same strings:
const furniture = ['chair', 'table', 'lamp'];
type Furniture = 'chair' | 'table' | 'lamp';
I need both in my application, but I am trying to keep my code DRY. So is there any way to infer one from the other?
I basically want to say something like type Furniture = [any string in furniture array]
, so there are no duplicate strings.