Skip to content

Commit

Permalink
fix ts type of injectSearchSourceReferences to avoid type casting (#7725
Browse files Browse the repository at this point in the history
) (#7762)

(cherry picked from commit 85fae59)

Signed-off-by: Yulong Ruan <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 020c6e9 commit 006b820
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { SavedObjectReference } from 'src/core/types';
import { SearchSourceFields } from './types';

export const injectReferences = (
searchSourceFields: SearchSourceFields & { indexRefName: string },
searchSourceFields: SearchSourceFields & { indexRefName?: string },
references: SavedObjectReference[]
) => {
const searchSourceReturnFields: SearchSourceFields = { ...searchSourceFields };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ export async function applyOpenSearchResp(
let searchSourceValues = parseSearchSourceJSON(meta.searchSourceJSON);

if (config.searchSource) {
searchSourceValues = injectSearchSourceReferences(
searchSourceValues as any,
resp.references
);
searchSourceValues = injectSearchSourceReferences(searchSourceValues, resp.references);
savedObject.searchSource = await dependencies.search.searchSource.create(
searchSourceValues
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function injectReferences(
) {
if (savedObject.searchSourceFields) {
savedObject.searchSourceFields = injectSearchSourceReferences(
savedObject.searchSourceFields as any,
savedObject.searchSourceFields,
references
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export function extractReferences({
export function injectReferences(savedObject: VisSavedObject, references: SavedObjectReference[]) {
if (savedObject.searchSourceFields) {
savedObject.searchSourceFields = injectSearchSourceReferences(
savedObject.searchSourceFields as any,
savedObject.searchSourceFields,
references
);
}
Expand Down

0 comments on commit 006b820

Please sign in to comment.