I am looking to create an interface that includes optional string values. Here is what I have in mind:
interface IEntity {
values: ['RemainingUnits', 'ActualUnits', 'PlannedUnits']
}
However, when implementing this interface, I encounter some problems:
const entity0: IEntity = { values: ['PlannedUnits'] }; // => Error
const entity1: IEntity = { values: ['RemainingUnits', 'ActualUnits'] }; // => Error
const entity2: IEntity = { values: ['PlannedUnits', 'RemainingUnits', 'ActualUnits'] }; // => Error
Is there a way to define the correct interface to prevent these errors?
Additionally, I want to ensure that there are no duplicate strings and that the array is not empty.