How to use the io-ts.null 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 maasglobal / maas-schemas / maas-schemas-ts / src / tsp / booking-receipt / request.ts View on Github external
import * as Booking_ from 'maas-schemas-ts/core/booking';

type Defined =
  | Record
  | Array
  | string
  | boolean
  | number
  | null;
const Defined = t.union([
  t.UnknownRecord,
  t.UnknownArray,
  t.string,
  t.boolean,
  t.number,
  t.null,
]);

export const schemaId = 'http://maasglobal.com/tsp/bookings-receipt/request.json';

// Request
// The default export. More information at the top.
export type Request = t.Branded<
  {
    tspId?: Booking_.TspId;
  } & {
    tspId: Defined;
  },
  RequestBrand
>;
export const Request = t.brand(
  t.intersection([
github maasglobal / maas-schemas / maas-schemas-ts / src / core / modes / MODE_SHARED_BICYCLE.ts View on Github external
import * as t from 'io-ts';

type Defined =
  | Record
  | Array
  | string
  | boolean
  | number
  | null;
const Defined = t.union([
  t.UnknownRecord,
  t.UnknownArray,
  t.string,
  t.boolean,
  t.number,
  t.null,
]);

export const schemaId = 'http://maasglobal.com/core/modes/MODE_SHARED_BICYCLE.json';

// MODE_SHARED_BICYCLE
// The default export. More information at the top.
export type MODE_SHARED_BICYCLE = t.Branded<
  {
    bike?: {
      id?: string;
      type?: string;
    } & {
      id: Defined;
    };
  },
  MODE_SHARED_BICYCLEBrand
github maasglobal / maas-schemas / maas-schemas-ts / src / maas-backend / customers / verification / media / list / request.ts View on Github external
import * as Units_ from 'maas-schemas-ts/core/components/units';

type Defined =
  | Record
  | Array
  | string
  | boolean
  | number
  | null;
const Defined = t.union([
  t.UnknownRecord,
  t.UnknownArray,
  t.string,
  t.boolean,
  t.number,
  t.null,
]);

export const schemaId =
  'http://maasglobal.com/maas-backend/customers/verification/media/list/request.json';

// Request
// The default export. More information at the top.
export type Request = t.Branded<
  {
    identityId?: Units_.IdentityId;
    customerId?: Units_.IdentityId;
  } & {
    identityId: Defined;
    customerId: Defined;
  },
  RequestBrand
github maasglobal / maas-schemas / maas-schemas-ts / src / core / modes / MODE_SCOOTER.ts View on Github external
import * as t from 'io-ts';

type Defined =
  | Record
  | Array
  | string
  | boolean
  | number
  | null;
const Defined = t.union([
  t.UnknownRecord,
  t.UnknownArray,
  t.string,
  t.boolean,
  t.number,
  t.null,
]);

export const schemaId = 'http://maasglobal.com/core/modes/MODE_SCOOTER.json';

// MODE_SCOOTER
// The default export. More information at the top.
export type MODE_SCOOTER = t.Branded<
  {
    scooter?: {
      id?: string;
    } & {
      id: Defined;
    };
  },
  MODE_SCOOTERBrand
>;
github maasglobal / maas-schemas / maas-schemas-ts / src / maas-backend / itineraries / itinerary-list / request.ts View on Github external
import * as ApiCommon_ from 'maas-schemas-ts/core/components/api-common';

type Defined =
  | Record
  | Array
  | string
  | boolean
  | number
  | null;
const Defined = t.union([
  t.UnknownRecord,
  t.UnknownArray,
  t.string,
  t.boolean,
  t.number,
  t.null,
]);

export const schemaId =
  'http://maasglobal.com/maas-backend/itineraries/itinerary-list/request.json';

// Request
// The default export. More information at the top.
export type Request = t.Branded<
  {
    identityId?: Units_.IdentityId;
    payload?: {
      startTime?: Units_.Time;
      endTime?: Units_.Time;
      states?: string;
      bookingId?: Booking_.Id;
      originalFare?: string;
github maasglobal / maas-schemas / maas-schemas-ts / src / maas-backend / customers / retrieve / request.ts View on Github external
import * as ApiCommon_ from 'maas-schemas-ts/core/components/api-common';

type Defined =
  | Record
  | Array
  | string
  | boolean
  | number
  | null;
const Defined = t.union([
  t.UnknownRecord,
  t.UnknownArray,
  t.string,
  t.boolean,
  t.number,
  t.null,
]);

export const schemaId =
  'http://maasglobal.com/maas-backend/customers/retrieve/request.json';

// Request
// The default export. More information at the top.
export type Request = t.Branded<
  {
    identityId?: Units_.IdentityId;
    customerId?: Units_.IdentityId;
    headers?: ApiCommon_.Headers;
  } & {
    identityId: Defined;
    customerId: Defined;
    headers: Defined;
github maasglobal / maas-schemas / maas-schemas-ts / src / core / profile.ts View on Github external
import * as Fare_ from 'maas-schemas-ts/core/components/fare';

type Defined =
  | Record
  | Array
  | string
  | boolean
  | number
  | null;
const Defined = t.union([
  t.UnknownRecord,
  t.UnknownArray,
  t.string,
  t.boolean,
  t.number,
  t.null,
]);

export const schemaId = 'http://maasglobal.com/core/profile.json';

// SubscriptionInstance
// The purpose of this remains a mystery
export type SubscriptionInstance = t.Branded<
  {
    id?: number;
    name?: string;
    plan?: {
      id?: string;
    } & {
      id: Defined;
    };
    addons?: Array;
github maasglobal / maas-schemas / maas-schemas-ts / src / maas-backend / push-notification / request.ts View on Github external
t.literal('InfoMessage'),
        t.literal('ZendeskReply'),
        t.literal('VerificationUpdate'),
      ]),
      data: t.union([
        t.intersection([
          t.partial({
            objectType: t.union([t.literal('Itinerary'), t.literal('Booking')]),
            ids: t.array(Units_.Uuid),
          }),
          t.type({
            objectType: Defined,
            ids: Defined,
          }),
        ]),
        t.null,
        t.intersection([
          t.partial({
            objectType: t.union([t.literal('Profile'), t.literal('Subscription')]),
            ids: t.array(Units_.IdentityId),
          }),
          t.type({
            objectType: Defined,
            ids: Defined,
          }),
        ]),
      ]),
    }),
    t.type({
      identityId: Defined,
      severity: Defined,
      badge: Defined,
github intraxia / wp-gistpen / client / deltas / jobsDelta.ts View on Github external
});

const runStatus = t.union([
  t.literal('scheduled'),
  t.literal('running'),
  t.literal('paused'),
  t.literal('finished'),
  t.literal('error'),
]);

const runEntity = t.type({
  ID: t.string,
  job: t.string,
  status: runStatus,
  scheduled_at: t.string,
  started_at: t.union([t.string, t.null]),
  finished_at: t.union([t.string, t.null]),
  rest_url: t.string,
  job_url: t.string,
  console_url: t.string,
});

const runResponse = t.array(runEntity);

const dispatchResponse = runEntity;

export const jobsDelta = ({ ajax$ }: JobsServices) => (
  actions$: Stream,
  state$: Property,
): Observable => {
  const fetch$ = state$
    .sampledBy(
github maasglobal / maas-schemas / maas-schemas-ts / src / core / components / car-rental.ts View on Github external
CarRentalBrand
>;
export const CarRental = t.brand(
  t.intersection([
    t.partial({
      id: t.string,
      name: t.string,
      description: t.string,
      image: Units_.Url,
      terms: t.unknown,
      car: t.intersection([
        t.partial({
          passengers: t.number,
          doors: t.array(t.number),
          luggage: t.array(t.number),
          transmission: t.union([t.literal('manual'), t.literal('automatic'), t.null]),
          fuel: t.union([
            t.literal('diesel'),
            t.literal('electric'),
            t.literal('ethanol'),
            t.literal('gasoline'),
            t.literal('hybrid'),
            t.literal('hydrogen'),
            t.literal('lpg'),
            t.literal('multifuel'),
            t.null,
          ]),
          classification: t.union([ACRISS_.ACRISS, t.null]),
          registrationPlate: t.string,
          damage: t.string,
          fuelLevel: t.number,
          location: UnitsGeo_.Location,