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 HasTrue<T> = 'true' extends keyof T ? true : false;
4
- type HasFalse<T> = 'false' extends keyof T ? true : false;
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,OAAO,CAAC,CAAC,IAAI,MAAM,SAAS,MAAM,CAAC,GAAG,IAAI,GAAG,KAAK,CAAA;AACvD,KAAK,QAAQ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unistyles",
3
- "version": "2.3.0-beta.2",
3
+ "version": "2.3.0",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -6,17 +6,16 @@ type ExtractVariantKeys<T> = T extends object
6
6
  ? ExtractVariant<T[keyof T]>
7
7
  : never
8
8
 
9
- type HasTrue<T> = 'true' extends keyof T ? true : false
10
- type HasFalse<T> = 'false' extends keyof T ? true : false
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
- ? [HasTrue<T>, HasFalse<T>] extends [true, true]
16
+ ? HasBooleanVariants<T> extends true
14
17
  ? keyof Omit<T, 'default'> | boolean | undefined
15
- : [HasTrue<T>] extends [true]
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