Although I haven't had personal experience with this particular library, if you are certain that you need to create an object like this on your own, consider using the following approach:
function generateCoordinates(latitude: number, longitude: number): Coordinates {
return {
latitude: function() {
return latitude;
},
longitude: function() {
return longitude;
}
} as Coordinates;
}
let pointA = generateCoordinates(0, 0);
let pointB = generateCoordinates(10, -10);
Implementing the interface directly may require casting an object to match the Coordinates
type due to the presence of the constructor
element, which should ideally be included in the static definitions for the type.