Skip to content

Commit

Permalink
chore: Drop type guard after TS bump
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Sep 10, 2024
1 parent 7234ca8 commit 78be419
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ComponentType, IndexedNode } from "@opensystemslab/planx-core/types";
import { Calculate } from "@planx/components/Calculate/model";
import { FileUploadAndLabel } from "@planx/components/FileUploadAndLabel/model";
import { List } from "@planx/components/List/model";
import { QuestionField } from "@planx/components/shared/Schema/model";
import { SearchResult } from "hooks/useSearch";
import { capitalize, get } from "lodash";
import { SLUGS } from "pages/FlowEditor/data/types";
Expand Down Expand Up @@ -75,8 +74,7 @@ const DISPLAY_DATA: Partial<ComponentMap> = {
getHeadline: ({ item, refIndex }) => {
// Fuse.js flattens deeply nested arrays when using refIndex
const options = (item.data as unknown as List).schema.fields
// TODO: Remove type guard when bumping to TS v5.5
.filter((field): field is QuestionField => field.type === "question")
.filter((field) => field.type === "question")
.flatMap((field) => field.data.options);
return options[refIndex].data.val || "";
},
Expand Down

0 comments on commit 78be419

Please sign in to comment.