-
-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
Description
Hey, thank you for your client!
I would like to use it for a TS-based project, but unfortunately since there are no published types, the typescript server throws errors. As a local fix, I manually added a flightradar24-client.d.ts file. Of course, it would be nicer if the types were recognised automatically.
Would you be willing to convert this client to TS or would you accept a PR that does this? As an interim solution, it would also be possible to add this .d.ts file manually, which could look something like this:
{
"name": "flightradar24-client",
"files": [
"index.js",
"lib"
],
+ "typings": "types.d.ts",
"keywords": [
"aviation",
"airplanes",
"flights",
"flightradar24"
]
}// types.d.ts
declare module 'flightradar24-client' {
function fetchFlight(flight: string): Promise<{
id: string | null;
callsign: string | null;
liveData: boolean;
model: string | null;
registration: string | null;
airline: string | null;
origin: {
id: string | null;
name: string | null;
coordinates: {
latitude: number | null;
longitude: number | null;
altitude: number | null;
};
timezone: string | null;
country: string | null;
};
destination: {
id: string | null;
name: string | null;
coordinates: {
latitude: number | null;
longitude: number | null;
altitude: number | null;
};
timezone: string | null;
country: string | null;
};
departure: string | null;
scheduledDeparture: string | null;
departureTerminal: string | null;
departureGate: string | null;
arrival: string | null;
scheduledArrival: string | null;
arrivalTerminal: string | null;
arrivalGate: string | null;
delay: number | null;
}>;
function fetchFromRadar(
north: number,
west: number,
south: number,
east: number,
when?: number,
opt?: Partial<{
FAA: boolean;
FLARM: boolean;
MLAT: boolean;
ADSB: boolean;
inAir: boolean;
onGround: boolean;
inactive: boolean;
gliders: boolean;
estimatedPositions: boolean;
}>
): Promise<
{
id: string;
registration: string | null;
flight: string | null;
callsign: string | null;
origin: string | null;
destination: string | null;
latitude: number;
longitude: number;
altitude: number;
bearing: number;
speed: number | null;
rateOfClimb: number;
isOnGround: boolean;
squawkCode: string;
model: string | null;
modeSCode: string | null;
radar: string;
isGlider: boolean;
timestamp: number | null;
}[]
>;
}Reactions are currently unavailable