import * as fun from "https://deno.land/x/fun@v2.0.0/schemable.ts";
Schemable presents a unified algebra for parsing, decoding guarding, or otherwise building typed js structures in TypeScript.
Interfaces
Takes a Schemable and returns a Schemable<ReadonlyArray> | |
Wraps a boolean type in Schemable. | |
Takes two schemables, left and right, and returns the intersection of them. This means that any value for must match both schemables. | |
Takes an id and a thunk returning a schemable and returns a schemable that matches the return value of the thunk. This schemable is necessary for handling recursive or corecursive schemables. | |
Wraps a union of literals in Schemable. | |
Takes a Schemable and returns a Schemable<A | null>; | |
Wraps a number type in Schemable. | |
Takes a struct of Schemables and returns a Schemable for a struct that matches, key for key, the input schemables but the values can also be partial. | |
Takes a Schemable and returns a Schemable<ReadonlyRecord> | |
A Schemable is the union of all schemable methods. This allows one to build an arbitrary Schema using the Schemable interface, then pass a concrete Schemable implementation to the Schema. Thus, one can build a single model and produce decoders, guards, or jsonschema from that model. | |
Wraps a string type in Schemable. | |
Takes a struct of Schemables and returns a Schemable for a struct that matches, key for key, the input schemables. | |
Takes a tuple of Schemables and returns a Schemable for a tuple that matches, index for index, the input schemables. | |
Takes a Schemable and returns a Schemable<A | undefined>; | |
Takes two schemables, left and right, and returns the union of them. This means that any value for must match either schemable. | |
Wraps an unknown type in Schemable. This is the best escape hatch when a Schema isn't known ahead of time. |
Type Aliases
These are the super-types that a Literal schema must extent. They are used to constrain the inputs for LiteralSchemable. | |
A Schema is the a function that takes a generic schemable and builds a specific model from it. | |
Extracts the inner type of a Schema |