Skip to main content

core.subsetresource

Home > @medplum/core > subsetResource

subsetResource() function

Construct the subset of a resource containing a minimum set of fields. The returned resource is not guaranteed to contain only the provided properties, and may contain others (e.g. resourceType and id)

Signature:

export declare function subsetResource<T extends Resource>(resource: T | undefined, properties: string[]): T | undefined;

Parameters

Parameter

Type

Description

resource

T | undefined

The resource to subset

properties

string[]

The minimum properties to include in the subset

Returns:

T | undefined

The modified resource, containing the listed properties and possibly other mandatory ones