File tree Expand file tree Collapse file tree 4 files changed +23
-14
lines changed Expand file tree Collapse file tree 4 files changed +23
-14
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import type { Exponent } from "./exponents";
5
5
import type {
6
6
BrandUnitClass ,
7
7
BrandUnitClassType ,
8
+ BrandUnitKeyValues ,
8
9
BrandUnitMeta ,
9
10
ExcludeUnitZeroSubvalues ,
10
11
RemoveNeverValues ,
@@ -115,15 +116,12 @@ export type UnknownUnitMeta = UnknownUnitKeyValues &
115
116
__uno_types__unit_meta_type : true ;
116
117
} > ;
117
118
118
- type UnitKeyValues < T extends UnitSubvalues > = Readonly < {
119
- __uom_types__keys : keyof ExcludeUnitZeroSubvalues < T > extends string ? keyof ExcludeUnitZeroSubvalues < T > : never ;
120
- __uom_types__value : RemoveNeverValues < T > ;
121
- } > ;
119
+ type UnitKeyValues < T extends UnitSubvalues > = BrandUnitKeyValues <
120
+ keyof ExcludeUnitZeroSubvalues < T > extends string ? keyof ExcludeUnitZeroSubvalues < T > : never ,
121
+ RemoveNeverValues < T >
122
+ > ;
122
123
123
- type UnknownUnitKeyValues = Readonly < {
124
- __uom_types__keys : string ;
125
- __uom_types__value : { } ;
126
- } > ;
124
+ type UnknownUnitKeyValues = BrandUnitKeyValues < string , { } > ;
127
125
128
126
/**
129
127
* A mapping of subvalue of a unit its magnitude.
Original file line number Diff line number Diff line change @@ -28,9 +28,9 @@ export type Square<
28
28
> = T extends number
29
29
? Pow < T , 2 >
30
30
: T extends UnknownUnitClass
31
- ? UnitClass < PowUnitSubvalues < T [ "__uom_types__value " ] , 2 > >
31
+ ? UnitClass < PowUnitSubvalues < T [ "__uom_types" ] [ "value "] , 2 > >
32
32
: T extends UnknownUnitMeta
33
- ? UnitMeta < PowUnitSubvalues < T [ "__uom_types__value " ] , 2 > >
33
+ ? UnitMeta < PowUnitSubvalues < T [ "__uom_types" ] [ "value "] , 2 > >
34
34
: never ;
35
35
36
36
/**
@@ -46,9 +46,9 @@ export type Cubic<
46
46
> = T extends number
47
47
? Pow < T , 3 >
48
48
: T extends UnknownUnitClass
49
- ? UnitClass < PowUnitSubvalues < T [ "__uom_types__value " ] , 3 > >
49
+ ? UnitClass < PowUnitSubvalues < T [ "__uom_types" ] [ "value "] , 3 > >
50
50
: T extends UnknownUnitMeta
51
- ? UnitMeta < PowUnitSubvalues < T [ "__uom_types__value " ] , 3 > >
51
+ ? UnitMeta < PowUnitSubvalues < T [ "__uom_types" ] [ "value "] , 3 > >
52
52
: never ;
53
53
54
54
// Tests
Original file line number Diff line number Diff line change @@ -26,9 +26,9 @@ export type Reciprocal<
26
26
> = T extends number
27
27
? Inverse < T >
28
28
: T extends UnknownUnitClass
29
- ? UnitClass < InverseUnitSubvalues < T [ "__uom_types__value " ] > >
29
+ ? UnitClass < InverseUnitSubvalues < T [ "__uom_types" ] [ "value "] > >
30
30
: T extends UnknownUnitMeta
31
- ? UnitMeta < InverseUnitSubvalues < T [ "__uom_types__value " ] > >
31
+ ? UnitMeta < InverseUnitSubvalues < T [ "__uom_types" ] [ "value "] > >
32
32
: never ;
33
33
34
34
// Tests
Original file line number Diff line number Diff line change @@ -36,6 +36,17 @@ export type BrandUnitClassType = Brand & {
36
36
} ;
37
37
} ;
38
38
39
+ /**
40
+ * Brand with the unit keys and value.
41
+ */
42
+ export type BrandUnitKeyValues < K , V > = Brand &
43
+ Readonly < {
44
+ __uom_types : {
45
+ keys : K ;
46
+ value : V ;
47
+ } ;
48
+ } > ;
49
+
39
50
/**
40
51
* Remove all key from the object that are `never`.
41
52
*/
You can’t perform that action at this time.
0 commit comments