/
types.ts
98 lines (91 loc) · 2.66 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/**
* Defines the structure of an internally used object which contains all the data on a certain date.
*/
export interface InternalValuesOnDate {
/**
* The date of the values.
*/
date: string;
/**
* The number of confirmed cases.
*/
confirmed: number;
/**
* The number of deaths. `null` if this information is not available.
*/
deaths: number | null;
/**
* The number of recoveries. `null` if this information is not available.
*/
recovered: number | null;
}
/**
* Defines an internally used array of objects which contain all the data on a certain date.
*/
export type InternalLocationDataValues = InternalValuesOnDate[];
/**
* Defines the structure of an internally used object which contains all the COVID-19 related
* values and information for a certain location.
*/
export interface InternalLocationData extends LocationInfo {
/**
* All the values for this location by date.
*/
values: InternalLocationDataValues;
}
/**
* Defines the structure of an object which contains the information on a certain location.
*/
export interface LocationInfo {
location: string;
countryOrRegion: string;
provinceOrState?: string;
county?: string;
latitude: string;
longitude: string;
}
/**
* Defines the structure of an object which contains all the data on a certain date.
*/
export interface ValuesOnDate extends InternalValuesOnDate {
/**
* The number of new confirmed cases on this date.
*/
newConfirmed: number;
/**
* The number of new deaths on this date. `null` if this information is not available.
*/
newDeaths: number | null;
/**
* The case fatality rate on this date. `null` if this information is not available.
*/
caseFatalityRate: number | null;
/**
* The number of new recoveries on this date. `null` if this information is not available.
*/
newRecovered: number | null;
/**
* The recovery rate out of all confirmed cases.
*/
recoveryRate: number | null;
/**
* The number of active cases on this date. `null` if either the `deaths` or `recovered` data is
* not available, as without them the number of active cases cannot be calculated.
*/
activeCases: number | null;
}
/**
* Defines an array of objects which contain all the data on a certain date.
*/
export type LocationDataValues = ValuesOnDate[];
/**
* Defines the structure of an object which contains all the COVID-19 related values and
* information for a certain location.
*/
export interface LocationData extends InternalLocationData {
/**
* All the values for this location by date.
*/
values: LocationDataValues;
}
export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>;