@iehr/fhirtypes
TypeScript icon, indicating that this package has built-in type declarations

5.1.8 • Public • Published

iEHR FHIR Type Definitions

This library contains TypeScript type definitions for all R4 types.

Installation

Add as a dependency:

npm install --save-dev @iehr/fhirtypes

Basic Usage

Consider the following untyped code:

const myPatient = {
  resourceType: 'Patient',
  name: 'George Washington',
};

Keen observers will note that Patient.name should not be a string. Instead, it should be an array of HumanName objects.

Let's add the type definition and see what happens:

import { Patient } from '@iehr/fhirtypes';

const myPatient: Patient = {
  resourceType: 'Patient',
  name: 'George Washington',
};

Now "name" is a compile error. Developer tools with TypeScript support should provide feedback. For example, VS Code adds red squigglies and a helpful error message.And now you will receive typeahead support. So we can build a well-formed example:

import { Patient } from '@iehr/fhirtypes';

const myPatient: Patient = {
  resourceType: 'Patient',
  name: [
    {
      given: ['George'],
      family: 'Washington',
    },
  ],
};

About iEHR

iEHR is a FHIR®-native, AI-infused, API-first, interoperable EHR. iEHR makes it easy to build healthcare apps quickly with less code.

License

Apache 2.0.

Copyright © Medplum 2025 (HL7® FHIR® US)

Copyright © iEHR.ai 2025 (HL7® FHIR® International, AI & Data platform)

Readme

Keywords

Package Sidebar

Install

npm i @iehr/fhirtypes

Homepage

www.iehr.ai/

Weekly Downloads

80

Version

5.1.8

License

Apache-2.0

Unpacked Size

2.64 MB

Total Files

215

Last publish

Collaborators

  • hamidrj
  • lmgc-bot
  • iehr-bot