Skip to main content

core.generatetypescriptdefinition

Home > @medplum/core > generateTypeScriptDefinition

generateTypeScriptDefinition() function​

Generates the contents of a TypeScript definition (.d.ts) file for a FHIR type schema, including its inner (backbone element) types.

The schema can be a base FHIR type or a profile, as returned by parseStructureDefinition or tryGetProfile.

Signature:

export declare function generateTypeScriptDefinition(fhirType: InternalTypeSchema, options?: TypeScriptGeneratorOptions): string | undefined;

Parameters​

Parameter

Type

Description

fhirType

InternalTypeSchema

The type schema to generate an interface for.

options

TypeScriptGeneratorOptions

(Optional) Optional generator options.

Returns:

string | undefined

The TypeScript file contents, or undefined if the type has no elements.