-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathglobals.d.ts
46 lines (36 loc) · 1.21 KB
/
globals.d.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
import * as rnKeychain from 'react-native-keychain';
import { Routes } from '@cardstack/navigation';
declare let __DEV__: boolean;
declare let akd: boolean;
/* Rainbow uses a rn-keychain patch with these two custom methods
* which are not part of rn-keychain lib types, so we need to add custom
* declarations
*/
declare module 'react-native-keychain' {
export function getAllInternetCredentials(): Promise<null | {
results: rnKeychain.UserCredentials[];
}>;
}
type OptionalUnion<T1, T2> = {
[P in keyof Omit<T1 & T2, keyof (T1 | T2)>]?: (T1 & T2)[P];
} &
(T1 | T2);
type KebabToCamelCase<
DashType
> = DashType extends `${infer First}-${infer Rest}`
? `${First}${KebabToCamelCase<Capitalize<Rest>>}`
: DashType;
type KebabToCamelCaseKeys<T> = {
[K in keyof T as K extends string ? KebabToCamelCase<K> : K]: T[K];
};
// TODO: add correct navigation types
type RoutesType = typeof Routes;
type RouteKeys = keyof RoutesType;
export type RouteNames = RoutesType[RouteKeys];
export type StackParamsList = Record<RouteNames, any>;
declare global {
namespace ReactNavigation {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface RootParamList extends StackParamsList {}
}
}