-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathglobal.d.ts
More file actions
36 lines (33 loc) · 771 Bytes
/
global.d.ts
File metadata and controls
36 lines (33 loc) · 771 Bytes
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
/**
* App Core Services
*/
export type AppServices =
| 'airtime'
| 'data'
| 'electricity'
| 'cable tv'
| 'scratch card';
/**
* IDs for fetching variations and plans for different app services
*/
export type AppServicePlansId =
| 'mtn-data'
| 'airtel-data'
| 'glo-data'
| 'etisalat-data'
| 'dstv'
| 'gotv'
| 'startimes'
| 'waec';
/**
* Returns the type of array items
*/
export type ArrayElementType<Type> = Type extends (infer ItemType)[]
? ItemType
: Type;
// JOKE: Brute force detect the element type of the resolved value of the promise returned by `getServicesPlans`
// let a: Parameters<
// Parameters<ReturnType<typeof getServicePlans>['then']>[0]
// >[0]['data']['variations'] extends Array<infer IT>
// ? IT
// : any;