Skip to content

Commit

Permalink
Update x-pack/solutions/observability/plugins/observability_ai_assist…
Browse files Browse the repository at this point in the history
…ant_management/public/routes/components/knowledge_base_bulk_import_flyout.tsx - Move the type assertion to the JSON parsing and let the compiler handle the rest.

Co-authored-by: Søren Louv-Jansen <[email protected]>
  • Loading branch information
arturoliduena and sorenlouv authored Jan 6, 2025
1 parent 35160fc commit 0753032
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ export function KnowledgeBaseBulkImportFlyout({ onClose }: { onClose: () => void
const elements = text.split('\n').filter(Boolean);

try {
const entries: Array<Omit<KnowledgeBaseEntry, '@timestamp' | 'title'> & { title: string }> =
elements.map((el) => JSON.parse(el));
const entries = elements.map(
(el) =>
JSON.parse(el) as Omit<KnowledgeBaseEntry, "@timestamp" | "title"> & {
title: string;
}
);
await mutateAsync({ entries });
} catch (_) {
toasts.addError(
Expand Down

0 comments on commit 0753032

Please sign in to comment.