@@ -10,15 +10,15 @@ import { fromUtf8, toUtf8 } from "@smithy/util-utf8";
10
10
/**
11
11
*
12
12
*/
13
- type CborListType < T = any > = Array < T > ;
14
- type CborMapType < T = any > = Record < string , T > ;
15
-
16
- type CborCollectionType < T = any > = CborMapType < T > | CborListType < T > ;
17
- type CborItemType = undefined | boolean | number | [ CborSliceType , Uint64Imprecise ] | string ;
13
+ type CborItemType = undefined | boolean | number | [ CborSliceType , Uint64Imprecise ] | string | CborTagType ;
18
14
type CborTagType = {
19
15
tag : Uint64Imprecise ;
20
16
value : CborValueType ;
21
17
} ;
18
+ type CborSliceType = Uint8Array ;
19
+ type CborListType < T = any > = Array < T > ;
20
+ type CborMapType < T = any > = Record < string , T > ;
21
+ type CborCollectionType < T = any > = CborMapType < T > | CborListType < T > ;
22
22
23
23
type CborValueType = CborItemType | CborCollectionType | any ;
24
24
@@ -33,8 +33,6 @@ type Uint64Imprecise = number;
33
33
type Float16 = number ;
34
34
type Float32 = number ;
35
35
36
- type CborSliceType = Uint8Array ;
37
-
38
36
type CborMajorType =
39
37
| typeof majorUint64
40
38
| typeof majorNegativeInt64
@@ -165,7 +163,7 @@ const readArgument = (payload: Uint8Array, byteLength: number): Uint64Imprecise
165
163
if ( byteLength === 2 ) return offsetDataView ( payload ) . getUint16 ( 0 ) ;
166
164
if ( byteLength === 4 ) return offsetDataView ( payload ) . getUint32 ( 0 ) ;
167
165
168
- // TODO: warning, truncation
166
+ // TODO(cbor) : warning, loss of precision.
169
167
return Number ( offsetDataView ( payload ) . getBigUint64 ( 0 ) ) ;
170
168
} ;
171
169
0 commit comments