I've attempted the following:
class PhraseService
phrasePosShortNames: [{ id: number, name: string }];
phrasePosNames = [
{
id: 0,
longName: '#',
shortName: '#'
},
{
id: 1,
longName: 'Noun',
shortName: '#'
},
{
id: 2,
longName: 'Verb',
shortName: 'V'
}
];
constructor( ) {
this.phrasePosShortNames = this.phrasePosNames.map(item => {
id: item.id,
name: item.longName
})
}
However, I encounter an error:
Severity Code Description Project File Line Suppression State Error TS2322 Type 'void[]' is not assignable to type '[{ id: number; name: string; }]'. Property '0' is missing in type 'void[]'
Could someone please point out my mistake?