In my TypeScript code, I am initializing an array of objects. I need to retrieve the id parameter of a specific object that I am initializing.
vacancies: Array<Vacancy> = [{
id: 1,
is_fav: this.favouritesService.favourites.find(fav => fav === this.id)
}];
The expression this.id refers to the id property of the current object being initialized, but it is giving me an error. Is there a way to access that property during initialization?