I have the following enum in my Angular 2 app:
export enum DataProviderDefinitionType {
JDBC = <any> "JDBC",
CSV = <any> "CSV",
EXCEL = <any> "EXCEL" }
I require to have an array containing all values of this enum. This should be programmed in a generic way. Recently I do have:
export namespace DataProviderDefinitionType {
export function obtainAllValues(): DataProviderDefinitionType[] {
var result: DataProviderDefinitionType[] = [];
result.push(DataProviderDefinitionType.JDBC);
result.push(DataProviderDefinitionType.CSV);
result.push(DataProviderDefinitionType.EXCEL);
return result;
}
This works, however is not a satisfying solution.
Any advice how to make that more generic?