react-native-unistyles 2.3.0-beta.2 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,7 @@
|
|
1
1
|
export type ExtractVariantNames<T> = T extends (...args: any) => infer R ? ExtractVariantKeys<R> : ExtractVariantKeys<T>;
|
2
2
|
type ExtractVariantKeys<T> = T extends object ? ExtractVariant<T[keyof T]> : never;
|
3
|
-
type
|
4
|
-
type
|
5
|
-
type ExtractSubVariantKeys<T> = T extends object ? [HasTrue<T>, HasFalse<T>] extends [true, true] ? keyof Omit<T, 'default'> | boolean | undefined : [HasTrue<T>] extends [true] ? keyof Omit<T, 'default'> | true | undefined : [HasFalse<T>] extends [true] ? keyof Omit<T, 'default'> | false | undefined : keyof Omit<T, 'default'> : never;
|
3
|
+
type HasBooleanVariants<T> = T extends Record<'true', any> ? true : T extends Record<'false', any> ? true : false;
|
4
|
+
type ExtractSubVariantKeys<T> = T extends object ? HasBooleanVariants<T> extends true ? keyof Omit<T, 'default'> | boolean | undefined : keyof Omit<T, 'default'> | undefined : never;
|
6
5
|
type ExtractVariant<T> = T extends (...args: any) => infer R ? R extends {
|
7
6
|
variants: infer V;
|
8
7
|
} ? {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../../../src/types/variants.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,MAAM,CAAC,GAClE,kBAAkB,CAAC,CAAC,CAAC,GACrB,kBAAkB,CAAC,CAAC,CAAC,CAAA;AAE3B,KAAK,kBAAkB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACvC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAC1B,KAAK,CAAA;AAEX,KAAK,
|
1
|
+
{"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../../../src/types/variants.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM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 -6,17 +6,16 @@ type ExtractVariantKeys<T> = T extends object
|
|
6
6
|
? ExtractVariant<T[keyof T]>
|
7
7
|
: never
|
8
8
|
|
9
|
-
type
|
10
|
-
|
9
|
+
type HasBooleanVariants<T> = T extends Record<'true', any>
|
10
|
+
? true
|
11
|
+
: T extends Record<'false', any>
|
12
|
+
? true
|
13
|
+
: false
|
11
14
|
|
12
15
|
type ExtractSubVariantKeys<T> = T extends object
|
13
|
-
?
|
16
|
+
? HasBooleanVariants<T> extends true
|
14
17
|
? keyof Omit<T, 'default'> | boolean | undefined
|
15
|
-
:
|
16
|
-
? keyof Omit<T, 'default'> | true | undefined
|
17
|
-
: [HasFalse<T>] extends [true]
|
18
|
-
? keyof Omit<T, 'default'> | false | undefined
|
19
|
-
: keyof Omit<T, 'default'>
|
18
|
+
: keyof Omit<T, 'default'> | undefined
|
20
19
|
: never
|
21
20
|
|
22
21
|
type ExtractVariant<T> = T extends (...args: any) => infer R
|