Here is a sample class structure:
export interface ILanguage {
shortName: string;
fullName: string;
}
export class Languages {
static readonly FRENCH: ILanguage = { shortName: 'fr', fullName: 'FRENCH' };
static readonly DUTCH: ILanguage = { shortName: 'nl', fullName: 'DUTCH' };
}
I want to transform this class into a simple array like this:
const array = [{ shortName: 'fr', fullName: 'FRENCH' }, { shortName: 'nl', fullName: 'DUTCH' }];
I think I need to iterate over the keys of the Languages class using:
Object.keys(Languages).forEach
However, I am unsure about the syntax for pushing the values into the array.