Skip to content

Commit e311f89

Browse files
committed
Convert Array types to simple [] type
1 parent f0f0899 commit e311f89

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

src/indexes.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ class Index<T extends RecordAny = RecordAny> {
474474
* @returns Promise containing an EnqueuedTask
475475
*/
476476
async updateDocuments(
477-
documents: Array<Partial<T>>,
477+
documents: Partial<T>[],
478478
options?: DocumentOptions,
479479
): Promise<EnqueuedTask> {
480480
const task = await this.httpRequest.put<EnqueuedTaskObject>({
@@ -495,7 +495,7 @@ class Index<T extends RecordAny = RecordAny> {
495495
* @returns Promise containing array of enqueued task objects for each batch
496496
*/
497497
async updateDocumentsInBatches(
498-
documents: Array<Partial<T>>,
498+
documents: Partial<T>[],
499499
batchSize = 1000,
500500
options?: DocumentOptions,
501501
): Promise<EnqueuedTask[]> {

src/types.ts

+9-11
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export type URLSearchParamsRecord = Record<
1818
string,
1919
| string
2020
| string[]
21-
| Array<string | string[]>
21+
| (string | string[])[]
2222
| number
2323
| number[]
2424
| boolean
@@ -162,7 +162,7 @@ export const MatchingStrategies = {
162162
export type MatchingStrategies =
163163
(typeof MatchingStrategies)[keyof typeof MatchingStrategies];
164164

165-
export type Filter = string | Array<string | string[]>;
165+
export type Filter = string | (string | string[])[];
166166

167167
export type Query = {
168168
q?: string | null;
@@ -304,7 +304,7 @@ export type CategoriesDistribution = {
304304
export type Facet = string;
305305
export type FacetDistribution = Record<Facet, CategoriesDistribution>;
306306
export type MatchesPosition<T> = Partial<
307-
Record<keyof T, Array<{ start: number; length: number; indices?: number[] }>>
307+
Record<keyof T, { start: number; length: number; indices?: number[] }[]>
308308
>;
309309

310310
export type RankingScoreDetails = {
@@ -352,7 +352,7 @@ export type Hit<T = RecordAny> = T & {
352352
_federation?: FederationDetails;
353353
};
354354

355-
export type Hits<T = RecordAny> = Array<Hit<T>>;
355+
export type Hits<T = RecordAny> = Hit<T>[];
356356

357357
export type FacetStat = { min: number; max: number };
358358
export type FacetStats = Record<string, FacetStat>;
@@ -415,7 +415,7 @@ type HasPage<S extends SearchParams> = undefined extends S["page"]
415415
export type MultiSearchResult<T> = SearchResponse<T> & { indexUid: string };
416416

417417
export type MultiSearchResponse<T = RecordAny> = {
418-
results: Array<MultiSearchResult<T>>;
418+
results: MultiSearchResult<T>[];
419419
};
420420

421421
export type MultiSearchResponseOrSearchResponse<
@@ -446,7 +446,7 @@ export type SearchSimilarDocumentsParams = {
446446
*/
447447

448448
type Fields<T = RecordAny> =
449-
| Array<Extract<keyof T, string>>
449+
| Extract<keyof T, string>[]
450450
| Extract<keyof T, string>;
451451

452452
export type DocumentOptions = {
@@ -771,9 +771,7 @@ export type TaskObject = Omit<EnqueuedTaskObject, "taskUid"> & {
771771
finishedAt: string;
772772
};
773773

774-
export type SwapIndexesParams = Array<{
775-
indexes: string[];
776-
}>;
774+
export type SwapIndexesParams = { indexes: string[] }[];
777775

778776
type CursorResults<T> = {
779777
results: T[];
@@ -816,7 +814,7 @@ export type BatchObject = {
816814
/** Progress and indexing step of the batch, null if the batch is finished */
817815
progress: null | {
818816
/** An array of all the steps currently being processed */
819-
steps: Array<{
817+
steps: {
820818
/**
821819
* A string representing the name of the current step NOT stable. Only use
822820
* for debugging purposes.
@@ -826,7 +824,7 @@ export type BatchObject = {
826824
finished: number;
827825
/** Total number of tasks to finish before moving to the next step */
828826
total: number;
829-
}>;
827+
}[];
830828
/** Percentage of progression of all steps currently being processed */
831829
percentage: number;
832830
};

tests/utils/meilisearch-test-utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ const datasetWithNests = [
174174
{ id: 7, title: "The Hitchhiker's Guide to the Galaxy" },
175175
];
176176

177-
const dataset: Array<{ id: number; title: string; comment?: string }> = [
177+
const dataset: { id: number; title: string; comment?: string }[] = [
178178
{ id: 123, title: "Pride and Prejudice", comment: "A great book" },
179179
{ id: 456, title: "Le Petit Prince", comment: "A french book" },
180180
{ id: 2, title: "Le Rouge et le Noir", comment: "Another french book" },

0 commit comments

Comments
 (0)