How to use the runtypes.Number function in runtypes

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

github citycide / trilogy / src / types.ts View on Github external
unique: t.Array(t.String),
  timestamps: t.Boolean
})

export const AggregateOptions = t.Partial({
  distinct: t.Boolean,
  group: GroupClause,
  order: OrderClause
})

export const CreateOptions = t.Partial({
  raw: t.Boolean
})

export const FindOptions = t.Partial({
  limit: t.Number,
  order: OrderClause,
  random: t.Boolean,
  raw: t.Boolean,
  skip: t.Number
})

export const UpdateOptions = t.Partial({
  raw: t.Boolean
})

export const ColumnKind = t.Union(t.String, t.Function).withConstraint(value => {
  const type = isFunction(value) ? value.name : String(value)
  return type.toLowerCase() in ColumnTypes
}, { name: 'ColumnKind' })

export const ColumnDescriptor = t.Partial({