Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
@medplum/fhirtypes
Advanced tools
This library contains TypeScript type definitions for all R4 types.
Add as a dependency:
npm install --save-dev @medplum/fhirtypes
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 '@medplum/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:
And now you will receive typeahead support:
So we can build a well-formed example:
import { Patient } from '@medplum/fhirtypes';
const myPatient: Patient = {
resourceType: 'Patient',
name: [
{
given: ['George'],
family: 'Washington',
},
],
};
Medplum is a healthcare platform that helps you quickly develop high-quality compliant applications. Medplum includes a FHIR server, React component library, and developer app.
Apache 2.0. Copyright © Medplum 2023
FAQs
Medplum FHIR Type Definitions
We found that @medplum/fhirtypes demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.