Skip to main content

core.isresource

Home > @medplum/core > isResource

isResource() function

Type guard to validate that an object is a FHIR resource

Signature:

export declare function isResource<T extends Resource>(value: unknown, resourceType?: T['resourceType']): value is T;

Parameters

Parameter

Type

Description

value

unknown

The object to check

resourceType

T['resourceType']

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

Returns:

value is T

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