Hyperlinkv0.8.0-beta.28

Schema

Schema.checkfunctioneffect/Schema.ts:5013
<S extends Top>(
  checks_0: SchemaAST.Check<S["Type"]>,
  ...checks: Array<SchemaAST.Check<S["Type"]>>
): (self: S) => S["Rebuild"]

Attaches one or more filter checks to a schema without changing the TypeScript type.

Example (Adding checks to a schema)

import { Schema } from "effect"

const AgeSchema = Schema.Number.pipe(
  Schema.check(Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(120))
)
filtering
Source effect/Schema.ts:50135 lines
export function check<S extends Top>(
  ...checks: readonly [SchemaAST.Check<S["Type"]>, ...Array<SchemaAST.Check<S["Type"]>>]
) {
  return (self: S): S["Rebuild"] => self.check(...checks)
}