I have this data in mongoDB (important field "period" is red border) :
I have this function that get some data:
myFunction(): void {
this.mySubscription = this.myObservable
.pipe(
map(data => data
.map(item => item.period))
)
.subscribe((res) => {
for (const entry of res) {
console.log('entry: ', entry);
}
});
At page display, i got this output in the console :
but if i want to get the same way, the startDate inside 'period' object i got this error in my .ts file:
property startDate does not exists on type {}:
Any help on this ? Thank you !
CodePudding user response:
it doesn't know whether it will have startDate. You can get rid of that error/warning by adding any type
so it would be (diapuse:any)


