circuit.ts:
import LocationFinder from './locationFinder';
export default class Circuit {
constructor(circuitParser: any) {
this.circuitId = circuitParser.circuitId;
this.url = circuitParser.url;
this.circuitName = circuitParser.circuitName;
this.location = new LocationFinder(circuitParser.LocationFinder);
}
circuitId: string;
url: string;
circuitName: string;
location: LocationFinder;
}
locationFinder.ts:
export default class LocationFinder {
constructor(locationParser: any) {
this.lat = parseFloat(locationParser.lat);
this.long = parseFloat(locationParser.long);
this.locality = locationParser.locality
this.country = locationParser.country
}
lat: number;
long: number;
locality: string;
country: string;
}
I am fairly new to using typescript, so I am not really familiar with this stuff. I don't quite understansd why TypeScript complains why LocationFinder is underfined (I assume that beacuse I would have gotten errors before about circuitPaser being undefined if it was). If anyone needs more information, here is the GitHub Repository: https://github.com/ultimatehecker/Formula-One-Wrapper