From 4578e362cd85939b1d6a424920d04bf01258510a Mon Sep 17 00:00:00 2001 From: Manuel Holtgrewe Date: Wed, 6 Mar 2024 16:24:54 +0100 Subject: [PATCH] fix: annonarsClient.fetchClinvarStrucvars in case of no records (#163) --- src/api/annonars/types.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/api/annonars/types.ts b/src/api/annonars/types.ts index 505c9b8..e59277a 100644 --- a/src/api/annonars/types.ts +++ b/src/api/annonars/types.ts @@ -15,7 +15,7 @@ import { Record as HelixmtdbRecord } from '../../pbs/annonars/helixmtdb/base' * Interface for Clinvar Strucvars query response as returned by */ export interface ClinvarSvQueryResponse$Api { - records: JsonValue[] + records?: JsonValue[] } /** @@ -30,8 +30,9 @@ export interface ClinvarSvQueryResponse { */ class ClinvarSvQueryResponse$Type { fromJson(apiResponse: ClinvarSvQueryResponse$Api): ClinvarSvQueryResponse { + const records = apiResponse.records ?? [] return { - records: apiResponse.records.map((value) => ClinvarStrucvarResponseRecord.fromJson(value)) + records: records.map((value) => ClinvarStrucvarResponseRecord.fromJson(value)) } } }