Skip to content

Commit

Permalink
feat(fhir-types): upgrade to use io-ts ^2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tangdrew committed Oct 24, 2019
1 parent fc20dc3 commit ef06551
Show file tree
Hide file tree
Showing 190 changed files with 45,587 additions and 53,918 deletions.
405 changes: 177 additions & 228 deletions packages/fhir-types/src/R4/Account.ts

Large diffs are not rendered by default.

810 changes: 388 additions & 422 deletions packages/fhir-types/src/R4/ActivityDefinition.ts

Large diffs are not rendered by default.

163 changes: 86 additions & 77 deletions packages/fhir-types/src/R4/Address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,101 +4,110 @@
import * as primitives from "@tangdrew/primitives";
import * as t from "io-ts";

import { Extension, ExtensionOutputType } from "./Extension";
import { Period, PeriodOutputType } from "./Period";
import { Element } from "./Element";
import { Extension } from "./Extension";
import { Period } from "./Period";

/**
* An address expressed using postal conventions (as opposed to GPS or other location definition formats)
*/
export interface Address {
/** Unique id for inter-element referencing */
id?: t.TypeOf<primitives.R4.StringType>;
id?: string;
/** Extension of id element */
_id?: Element;
/** Additional content defined by implementations */
extension?: Extension[];
/** home | work | temp | old | billing - purpose of this address */
use?: t.TypeOf<primitives.R4.CodeType>;
use?: primitives.R4.code;
/** Extension of use element */
_use?: Element;
/** postal | physical | both */
type?: t.TypeOf<primitives.R4.CodeType>;
type?: primitives.R4.code;
/** Extension of type element */
_type?: Element;
/** Text representation of the address */
text?: t.TypeOf<primitives.R4.StringType>;
text?: string;
/** Extension of text element */
_text?: Element;
/** Street name, number, direction & P.O. Box etc. */
line?: t.TypeOf<primitives.R4.StringType>[];
line?: string[];
/** Extension of line element */
_line?: Element[];
/** Name of city, town etc. */
city?: t.TypeOf<primitives.R4.StringType>;
city?: string;
/** Extension of city element */
_city?: Element;
/** District name (aka county) */
district?: t.TypeOf<primitives.R4.StringType>;
district?: string;
/** Extension of district element */
_district?: Element;
/** Sub-unit of country (abbreviations ok) */
state?: t.TypeOf<primitives.R4.StringType>;
state?: string;
/** Extension of state element */
_state?: Element;
/** Postal code for area */
postalCode?: t.TypeOf<primitives.R4.StringType>;
postalCode?: string;
/** Extension of postalCode element */
_postalCode?: Element;
/** Country (e.g. can be ISO 3166 2 or 3 letter code) */
country?: t.TypeOf<primitives.R4.StringType>;
country?: string;
/** Extension of country element */
_country?: Element;
/** Time period when address was/is in use */
period?: Period;
}

export interface AddressOutputType {
/** Unique id for inter-element referencing */
id?: t.OutputOf<primitives.R4.StringType>;
/** Additional content defined by implementations */
extension?: ExtensionOutputType[];
/** home | work | temp | old | billing - purpose of this address */
use?: t.OutputOf<primitives.R4.CodeType>;
/** postal | physical | both */
type?: t.OutputOf<primitives.R4.CodeType>;
/** Text representation of the address */
text?: t.OutputOf<primitives.R4.StringType>;
/** Street name, number, direction & P.O. Box etc. */
line?: t.OutputOf<primitives.R4.StringType>[];
/** Name of city, town etc. */
city?: t.OutputOf<primitives.R4.StringType>;
/** District name (aka county) */
district?: t.OutputOf<primitives.R4.StringType>;
/** Sub-unit of country (abbreviations ok) */
state?: t.OutputOf<primitives.R4.StringType>;
/** Postal code for area */
postalCode?: t.OutputOf<primitives.R4.StringType>;
/** Country (e.g. can be ISO 3166 2 or 3 letter code) */
country?: t.OutputOf<primitives.R4.StringType>;
/** Time period when address was/is in use */
period?: PeriodOutputType;
}

export const Address: t.RecursiveType<
t.Type<Address, AddressOutputType>,
Address,
AddressOutputType
> = t.recursion<Address, AddressOutputType>("Address", () =>
t.intersection(
[
t.type({}),
t.partial({
/** Name of city, town etc. */
city: primitives.R4.string,
/** Country (e.g. can be ISO 3166 2 or 3 letter code) */
country: primitives.R4.string,
/** District name (aka county) */
district: primitives.R4.string,
/** Additional content defined by implementations */
extension: t.array(Extension),
/** Unique id for inter-element referencing */
id: primitives.R4.string,
/** Street name, number, direction & P.O. Box etc. */
line: t.array(primitives.R4.string),
/** Time period when address was/is in use */
period: Period,
/** Postal code for area */
postalCode: primitives.R4.string,
/** Sub-unit of country (abbreviations ok) */
state: primitives.R4.string,
/** Text representation of the address */
text: primitives.R4.string,
/** postal | physical | both */
type: primitives.R4.code,
/** home | work | temp | old | billing - purpose of this address */
use: primitives.R4.code
})
],
"Address"
)
/**
* An address expressed using postal conventions (as opposed to GPS or other location definition formats)
*/
export const Address: t.Type<Address> = t.recursion<Address>("Address", () =>
t.intersection([
t.type({}),
t.partial({
/** Unique id for inter-element referencing */
id: primitives.R4.string,
/** Extension of id element */
_id: Element,
/** Additional content defined by implementations */
extension: t.array(Extension),
/** home | work | temp | old | billing - purpose of this address */
use: primitives.R4.code,
/** Extension of use element */
_use: Element,
/** postal | physical | both */
type: primitives.R4.code,
/** Extension of type element */
_type: Element,
/** Text representation of the address */
text: primitives.R4.string,
/** Extension of text element */
_text: Element,
/** Street name, number, direction & P.O. Box etc. */
line: t.array(primitives.R4.string),
/** Extension of line element */
_line: t.array(Element),
/** Name of city, town etc. */
city: primitives.R4.string,
/** Extension of city element */
_city: Element,
/** District name (aka county) */
district: primitives.R4.string,
/** Extension of district element */
_district: Element,
/** Sub-unit of country (abbreviations ok) */
state: primitives.R4.string,
/** Extension of state element */
_state: Element,
/** Postal code for area */
postalCode: primitives.R4.string,
/** Extension of postalCode element */
_postalCode: Element,
/** Country (e.g. can be ISO 3166 2 or 3 letter code) */
country: primitives.R4.string,
/** Extension of country element */
_country: Element,
/** Time period when address was/is in use */
period: Period
})
])
);
Loading

0 comments on commit ef06551

Please sign in to comment.