1.0.0 • Published 2 years ago

@antsa/fhirtypes v1.0.0

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
2 years ago

Antsa FHIR Type Definitions

This library contains TypeScript type definitions for all R4 types.

Installation

Add as a dependency:

npm install --save-dev @antsa/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 '@antsa/fhirtypes';

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

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:

Antsa fhirtypes screenshot

And now you will receive typeahead support:

Antsa fhirtypes typeahead

So we can build a well-formed example:

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

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

About Antsa

Antsa is a healthcare platform that helps you quickly develop high-quality compliant applications. Antsa includes a FHIR server, React component library, and developer app.

License

Apache 2.0. Copyright © Antsa 2023