OpenSearch-Dashboards icon indicating copy to clipboard operation
OpenSearch-Dashboards copied to clipboard

[BUG] Type errors in sort in `OpenSearchHitRecord`

Open abbyhu2000 opened this issue 1 year ago • 0 comments

Describe the bug

In src/plugins/discover/public/application/components/doc_views/context/api/anchor.ts, fetchAnchor function returns the following

  return {
    ...doc,
    isAnchor: true,
  } as OpenSearchHitRecord;

It has type error Types of property 'sort' are incompatible.Type 'string[] | undefined' is not comparable to type 'number[]'. because OpenSearchHitRecord set the sort to be number[] type but sort is returned as a string[] type.

export interface OpenSearchHitRecord {
  fields: Record<string, any>;
  sort: number[];
  _source: Record<string, any>;
  _id: string;
  isAnchor?: boolean;
}

Why is sort being defined as number[] in OpenSearchHitRecord? Is this an error? Screenshot 2024-06-19 at 5 18 24 PM

abbyhu2000 avatar Jun 20 '24 00:06 abbyhu2000