How to use the io-ts.array function in io-ts

To help you get started, we’ve selected a few io-ts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github elastic / kibana / x-pack / legacy / plugins / siem / server / lib / timeline / types.ts View on Github external
/*
 *  Sort Types
 */
const SavedSortRuntimeType = runtimeTypes.partial({
  columnId: unionWithNullType(runtimeTypes.string),
  sortDirection: unionWithNullType(runtimeTypes.string),
});

/*
 *  Timeline Types
 */
export const SavedTimelineRuntimeType = runtimeTypes.partial({
  columns: unionWithNullType(runtimeTypes.array(SavedColumnHeaderRuntimeType)),
  dataProviders: unionWithNullType(runtimeTypes.array(SavedDataProviderRuntimeType)),
  description: unionWithNullType(runtimeTypes.string),
  favorite: unionWithNullType(runtimeTypes.array(SavedFavoriteRuntimeType)),
  filters: unionWithNullType(runtimeTypes.array(SavedFilterRuntimeType)),
  kqlMode: unionWithNullType(runtimeTypes.string),
  kqlQuery: unionWithNullType(SavedFilterQueryQueryRuntimeType),
  title: unionWithNullType(runtimeTypes.string),
  dateRange: unionWithNullType(SavedDateRangePickerRuntimeType),
  savedQueryId: unionWithNullType(runtimeTypes.string),
  sort: unionWithNullType(SavedSortRuntimeType),
  created: unionWithNullType(runtimeTypes.number),
  createdBy: unionWithNullType(runtimeTypes.string),
  updated: unionWithNullType(runtimeTypes.number),
  updatedBy: unionWithNullType(runtimeTypes.string),
});

export interface SavedTimeline extends runtimeTypes.TypeOf {}

export interface SavedTimelineNote extends runtimeTypes.TypeOf {}
github tangdrew / fhir-ts / packages / fhir-types / src / R4 / Measure.ts View on Github external
/** How is rate aggregation performed for this measure */
      rateAggregation: primitives.R4.string,
      /** Extension of rateAggregation element */
      _rateAggregation: Element,
      /** Detailed description of why the measure exists */
      rationale: primitives.R4.markdown,
      /** Extension of rationale element */
      _rationale: Element,
      /** Summary of clinical guidelines */
      clinicalRecommendationStatement: primitives.R4.markdown,
      /** Extension of clinicalRecommendationStatement element */
      _clinicalRecommendationStatement: Element,
      /** increase | decrease */
      improvementNotation: CodeableConcept,
      /** Defined terms used in the measure documentation */
      definition: t.array(primitives.R4.markdown),
      /** Extension of definition element */
      _definition: t.array(Element),
      /** Additional guidance for implementers */
      guidance: primitives.R4.markdown,
      /** Extension of guidance element */
      _guidance: Element
    })
  ])
);
github tangdrew / fhir-ts / packages / fhir-types / src / R4 / AppointmentResponse.ts View on Github external
/** Additional content defined by implementations */
      extension: t.array(Extension),
      /** Extensions that cannot be ignored */
      modifierExtension: t.array(Extension),
      /** External Ids for this item */
      identifier: t.array(Identifier),
      /** Time from appointment, or requested new start time */
      start: primitives.R4.instant,
      /** Extension of start element */
      _start: Element,
      /** Time from appointment, or requested new end time */
      end: primitives.R4.instant,
      /** Extension of end element */
      _end: Element,
      /** Role of participant in the appointment */
      participantType: t.array(CodeableConcept),
      /** Person, Location, HealthcareService, or Device */
      actor: Reference,
      /** Extension of participantStatus element */
      _participantStatus: Element,
      /** Additional comments */
      comment: primitives.R4.string,
      /** Extension of comment element */
      _comment: Element
    })
  ])
);
github tangdrew / fhir-ts / packages / fhir-types / src / R4 / MedicinalProductInteraction.ts View on Github external
/** A set of rules under which this content was created */
        implicitRules: primitives.R4.uri,
        /** Extension of implicitRules element */
        _implicitRules: Element,
        /** Language of the resource content */
        language: primitives.R4.code,
        /** Extension of language element */
        _language: Element,
        /** Text summary of the resource, for human interpretation */
        text: Narrative,
        /** Contained, inline Resources */
        contained: t.array(Resource),
        /** Additional content defined by implementations */
        extension: t.array(Extension),
        /** Extensions that cannot be ignored */
        modifierExtension: t.array(Extension),
        /** The medication for which this is a described interaction */
        subject: t.array(Reference),
        /** The interaction described */
        description: primitives.R4.string,
        /** Extension of description element */
        _description: Element,
        /** The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction */
        type: CodeableConcept,
        /** The effect of the interaction, for example "reduced gastric absorption of primary medication" */
        effect: CodeableConcept,
        /** The incidence of the interaction, e.g. theoretical, observed */
        incidence: CodeableConcept,
        /** Actions for managing the interaction */
        management: CodeableConcept
      })
    ])
github Dragory / ZeppelinBot / backend / src / utils.ts View on Github external
export function tDeepPartial(type: T): TDeepPartial {
  if (type instanceof t.InterfaceType) {
    const newProps = {};
    for (const [key, prop] of Object.entries(type.props)) {
      newProps[key] = tDeepPartial(prop);
    }
    return t.partial(newProps) as TDeepPartial;
  } else if (type instanceof t.DictionaryType) {
    return t.record(type.domain, tDeepPartial(type.codomain)) as TDeepPartial;
  } else if (type instanceof t.UnionType) {
    return t.union(type.types.map(unionType => tDeepPartial(unionType))) as TDeepPartial;
  } else if (type instanceof t.IntersectionType) {
    const types = type.types.map(intersectionType => tDeepPartial(intersectionType));
    return (t.intersection(types as [t.Mixed, t.Mixed]) as unknown) as TDeepPartial;
  } else if (type instanceof t.ArrayType) {
    return t.array(tDeepPartial(type.type)) as TDeepPartial;
  } else {
    return type as TDeepPartial;
  }
}
github tangdrew / fhir-ts / packages / fhir-types / src / R4 / CodeSystem.ts View on Github external
/** Extension of status element */
        _status: Element,
        /** For testing purposes, not real usage */
        experimental: primitives.R4.boolean,
        /** Extension of experimental element */
        _experimental: Element,
        /** Date last changed */
        date: primitives.R4.dateTime,
        /** Extension of date element */
        _date: Element,
        /** Name of the publisher (organization or individual) */
        publisher: primitives.R4.string,
        /** Extension of publisher element */
        _publisher: Element,
        /** Contact details for the publisher */
        contact: t.array(ContactDetail),
        /** Natural language description of the code system */
        description: primitives.R4.markdown,
        /** Extension of description element */
        _description: Element,
        /** The context that the content is intended to support */
        useContext: t.array(UsageContext),
        /** Intended jurisdiction for code system (if applicable) */
        jurisdiction: t.array(CodeableConcept),
        /** Why this code system is defined */
        purpose: primitives.R4.markdown,
        /** Extension of purpose element */
        _purpose: Element,
        /** Use and/or publishing restrictions */
        copyright: primitives.R4.markdown,
        /** Extension of copyright element */
        _copyright: Element,
github tangdrew / fhir-ts / packages / fhir-types / src / R4 / EnrollmentRequest.ts View on Github external
/** A set of rules under which this content was created */
      implicitRules: primitives.R4.uri,
      /** Extension of implicitRules element */
      _implicitRules: Element,
      /** Language of the resource content */
      language: primitives.R4.code,
      /** Extension of language element */
      _language: Element,
      /** Text summary of the resource, for human interpretation */
      text: Narrative,
      /** Contained, inline Resources */
      contained: t.array(Resource),
      /** Additional content defined by implementations */
      extension: t.array(Extension),
      /** Extensions that cannot be ignored */
      modifierExtension: t.array(Extension),
      /** Business Identifier */
      identifier: t.array(Identifier),
      /** active | cancelled | draft | entered-in-error */
      status: primitives.R4.code,
      /** Extension of status element */
      _status: Element,
      /** Creation date */
      created: primitives.R4.dateTime,
      /** Extension of created element */
      _created: Element,
      /** Target */
      insurer: Reference,
      /** Responsible practitioner */
      provider: Reference,
      /** The subject to be enrolled */
      candidate: Reference,
github tangdrew / fhir-ts / packages / fhir-types / src / R4 / Timing.ts View on Github external
/** Extension of periodMax element */
        _periodMax: Element,
        /** s | min | h | d | wk | mo | a - unit of time (UCUM) */
        periodUnit: primitives.R4.code,
        /** Extension of periodUnit element */
        _periodUnit: Element,
        /** mon | tue | wed | thu | fri | sat | sun */
        dayOfWeek: t.array(primitives.R4.code),
        /** Extension of dayOfWeek element */
        _dayOfWeek: t.array(Element),
        /** Time of day for action */
        timeOfDay: t.array(primitives.R4.time),
        /** Extension of timeOfDay element */
        _timeOfDay: t.array(Element),
        /** Code for time period of occurrence */
        when: t.array(primitives.R4.code),
        /** Extension of when element */
        _when: t.array(Element),
        /** Minutes from event (before or after) */
        offset: primitives.R4.unsignedInt,
        /** Extension of offset element */
        _offset: Element
      })
    ])
);
github tangdrew / fhir-ts / packages / fhir-types / src / R4 / Encounter.ts View on Github external
/** Extension of id element */
        _id: Element,
        /** Metadata about the resource */
        meta: Meta,
        /** A set of rules under which this content was created */
        implicitRules: primitives.R4.uri,
        /** Extension of implicitRules element */
        _implicitRules: Element,
        /** Language of the resource content */
        language: primitives.R4.code,
        /** Extension of language element */
        _language: Element,
        /** Text summary of the resource, for human interpretation */
        text: Narrative,
        /** Contained, inline Resources */
        contained: t.array(Resource),
        /** Additional content defined by implementations */
        extension: t.array(Extension),
        /** Extensions that cannot be ignored */
        modifierExtension: t.array(Extension),
        /** Identifier(s) by which this encounter is known */
        identifier: t.array(Identifier),
        /** Extension of status element */
        _status: Element,
        /** Specific type of encounter */
        type: t.array(CodeableConcept),
        /** Specific type of service */
        serviceType: CodeableConcept,
        /** Indicates the urgency of the encounter */
        priority: CodeableConcept,
        /** The patient or group present at the encounter */
        subject: Reference,
github maasglobal / maas-schemas / maas-schemas-ts / src / environments / environments.ts View on Github external
export type EnvironmentGroup = t.Branded<
  {
    name?: EnvironmentGroupName;
    envs?: Array;
    description?: EnvironmentGroupDescription;
  } & {
    name: Defined;
    envs: Defined;
  },
  EnvironmentGroupBrand
>;
export const EnvironmentGroup = t.brand(
  t.intersection([
    t.partial({
      name: EnvironmentGroupName,
      envs: t.array(Environment),
      description: EnvironmentGroupDescription,
    }),
    t.type({
      name: Defined,
      envs: Defined,
    }),
  ]),
  (
    x,
  ): x is t.Branded<
    {
      name?: EnvironmentGroupName;
      envs?: Array;
      description?: EnvironmentGroupDescription;
    } & {
      name: Defined;