Skip to content

Commit c2292f5

Browse files
committed
Address comments
1 parent bb9102c commit c2292f5

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/types/browse.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export interface BrowseResultData extends Record<string, any> {
137137
is_slotted: false;
138138
labels: Record<string, any>;
139139
variations?: Record<string, any>[];
140-
variationsMap?: VariationsMapResponse;
140+
variations_map?: VariationsMapResponse;
141141
}
142142

143143
export interface BrowseRequestType extends Record<string, any> {

src/types/index.d.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ export * from './browse';
1212
export * from './tracker';
1313
export * from './event-dispatcher';
1414

15+
type RequireAtLeastOne<T, Keys extends keyof T = keyof T> =
16+
Pick<T, Exclude<keyof T, Keys>> &
17+
{ [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>> }[Keys];
18+
1519
export interface NetworkParameters extends Record<string, any> {
1620
timeout?: number;
1721
}
@@ -227,11 +231,11 @@ export interface VariationsMapRange {
227231

228232
export type FilterNode = VariationsMapSingleFilter | VariationsMapRange;
229233

230-
export interface FilterBy {
234+
export type FilterBy = RequireAtLeastOne<{
231235
and?: Array<FilterNode | FilterBy>;
232236
or?: Array<FilterNode | FilterBy>;
233237
not?: FilterNode | FilterBy;
234-
}
238+
}>;
235239

236240
export interface Item extends Record<string, any> {
237241
value: string;
@@ -241,7 +245,7 @@ export interface Item extends Record<string, any> {
241245
data?: ItemData;
242246
strategy?: { id: string };
243247
variations?: { data?: ItemData, value: string }[]
244-
variationsMap?: VariationsMapResponse;
248+
variations_map?: VariationsMapResponse;
245249
}
246250

247251
export interface ItemData extends Record<string, any> {
@@ -279,7 +283,6 @@ export interface VariationsMapValueCount extends VariationsMapBaseValue {
279283

280284
export interface VariationsMapStandardValue extends VariationsMapBaseValue {
281285
aggregation: Exclude<Aggregation, 'value_count'>;
282-
field: string;
283286
}
284287

285288
export interface VariationsMap {

0 commit comments

Comments
 (0)