Skip to main content

core.isreference

Home > @medplum/core > isReference

isReference() function

Type guard to validate that an object is a FHIR reference

Signature:

export declare function isReference<T extends Resource = Resource>(value: unknown, resourceType?: T['resourceType']): value is Reference<T> & {
reference: string;
};

Parameters

Parameter

Type

Description

value

unknown

The object to check

resourceType

T['resourceType']

(Optional) Checks that the reference is of the given type

Returns:

value is Reference<T> & { reference: string; }

True if the input is of type 'object' and contains property 'reference'