Skip to main content

core.ismedicationarray

Home > @medplum/core > isMedicationArray

isMedicationArray() function

Type guard: validates an array of Medication resources (drug search bot output).

Walks every entry rather than spot-checking the first so a tuple-shaped payload like [Medication, MedicationRequest] is rejected (see PR [#8999](https://github.com/medplum/medplum/pull/8999\#discussion\_r3276251617)).

Signature:

export declare function isMedicationArray(value: unknown): value is Medication[];

Parameters

Parameter

Type

Description

value

unknown

Unknown bot JSON payload.

Returns:

value is Medication[]

True when the value is an array (possibly empty) where every entry passes isResource<Medication>.