We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3966ca5 commit 7b68618Copy full SHA for 7b68618
src/types.ts
@@ -0,0 +1,24 @@
1
+/**
2
+ * @file types.ts
3
+ * @author Krisna Pranav
4
+ * @brief Types
5
+ * @version 1.0
6
+ * @date 2024-10-21
7
+ *
8
+ * @copyright Copyright (c) 2024 Krisna Pranav
9
10
+ */
11
+
12
+import { ImageSourcePropType } from "react-native";
13
14
+type Undefined<T> = { [P in keyof T]: P extends undefined ? T[P] : never};
15
16
+type FilterFlags<Base, Condition> = {
17
+ [Key in keyof Base]: Base[Key] extends Condition ? Key : never;
18
+};
19
20
+type AllowedNames<Base, Condition> = FilterFlags<Base, Condition>[keyof Base];
21
+type SubType<Base, Condition> = Pick<Base, AllowedNames<Base, Condition>>;
22
23
+export type OptionalKeys<T> = Exclude<keyof T, NonNullable<keyof SubType<Undefined<T>, never>>>;
24
0 commit comments