Skip to content

Commit f76bca2

Browse files
committed
.
1 parent f896f3a commit f76bca2

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

packages/core/src/attributes.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ export type RawAttribute<T> = T extends { value: any } | { unit: any } ? Attribu
88

99
export type Attributes = Record<string, TypedAttributeValue>;
1010

11-
export type AttributeValueType = string | number | boolean | Array<unknown>;
11+
export type AttributeValueType = string | number | boolean | Array<string> | Array<number> | Array<boolean>;
1212

1313
type AttributeTypeMap = {
1414
string: string;
1515
integer: number;
1616
double: number;
1717
boolean: boolean;
18-
array: Array<unknown>;
18+
array: Array<string> | Array<number> | Array<boolean>;
1919
};
2020

2121
/* Generates a type from the AttributeTypeMap like:
@@ -143,14 +143,10 @@ export function estimateTypedAttributesSizeInBytes(attributes: Attributes | unde
143143
weight += (attr.unit?.length ?? 0) * 2;
144144
const val = attr.value;
145145

146-
if (Array.isArray(val) && isPrimitive(val[0])) {
146+
if (Array.isArray(val)) {
147147
// Assumption: Individual array items have the same type and roughly the same size
148148
// probably not always true but allows us to cut down on runtime
149149
weight += estimatePrimitiveSizeInBytes(val[0]) * val.length;
150-
} else if (Array.isArray(val) && !isPrimitive(val[0])) {
151-
// Fallback for arrays with non-primitive values (e.g. objects)
152-
// Again (to cut down on runtime), we intentionally don't traverse the full hierarchy
153-
weight += fallbackWeight * val.length;
154150
} else if (isPrimitive(val)) {
155151
weight += estimatePrimitiveSizeInBytes(val);
156152
} else {

0 commit comments

Comments
 (0)