Still learning Typescript and I have this object
export class Marker {
position: {
lat: number,
lng: number,
};
label: {
color: string,
text: string,
};
title: string;
options: {
animation: any,
};
}
and in my code where I use it I do so like this, but marker.position is undefined
for (const ybEvent of this.Events) {
const marker = new Marker();
marker.title = ybEvent.name;
marker.position.lat = ybEvent.latitude;
marker.position.lng = ybEvent.longitude;
marker.label.color = 'blue';
marker.label.text = ybEvent.description;
marker.options.animation = google.maps.Animation.BOUNCE;
this.markers.push(marker);
}
What is the best way to initialize position, label, and options in this object?

marker.position = {}and thenmarker.position.lat = some valuemarker.position = { lat : some value , ...}