Skip to content

Commit 7b68618

Browse files
committed
src: types
1 parent 3966ca5 commit 7b68618

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/types.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)