Skip to main content

core.parsereference

Home > @medplum/core > parseReference

parseReference() function

Parses a reference and returns a tuple of [ResourceType, ID].

Signature:

export declare function parseReference<T extends Resource>(reference: Reference<T> | undefined): [T['resourceType'], string];

Parameters

Parameter

Type

Description

reference

Reference<T> | undefined

A reference to a FHIR resource.

Returns:

[T['resourceType'], string]

A tuple containing the ResourceType and the ID of the resource or undefined when undefined or an invalid reference is passed.