Loading docs…
Loading docs…
Public type exports for guard authoring, parse results, schema inference, and type-level extensions.
Primary and advanced types are equally supported public API. The classification only controls discoverability: start with primary types and reach for advanced types when building reusable wrappers.
import { isString, optionalKey, struct } from 'is-kit';import type {InferSchema,ParseResult,Predicate,StructOptions,} from 'is-kit';const userSchema = {id: isString,nickname: optionalKey(isString),} as const;type User = InferSchema<typeof userSchema>;const options: StructOptions = { exact: true };const isUser: Predicate<User> = struct(userSchema, options);declare const result: ParseResult<User>;if (result.valid) {result.value.id; // string}
Predicate<T>, Guard<T> — The core unknown-input type guard contract. Guard is a readability alias for Predicate.Refinement<A, B>, Refine<A, B> — Narrows a known input type A to a subtype B. Refine is a readability alias for Refinement.ParseResult<T> — The tagged valid/value result returned by safeParse and related helpers.Primitive — The union of JavaScript primitive value types.InferSchema<S> — Infers the readonly object type represented by a struct schema.StructOptions — The public exact-key options accepted by struct and typedStruct.TypedStructShape<T>, TypedStructFields<T, S> — Public contracts for annotating wrappers and reusable helpers around typedStruct.GuardedOf<F> — Extracts the guarded output type from one predicate.OutOfGuards<T>, GuardedWithin<Fs, A> — Extracts and constrains unions produced by collections of guards.RefineChain<In, T>, ChainResult<In, T> — Models the ordered refinements and final output used by refinement chains.OptionalSchemaField<G>, SchemaField, Schema — Building blocks for wrappers that accept or construct struct schemas.NoExtraKeys<S, Shape> — Rejects keys outside an expected type-level shape.OptionalObjectKeys<T>, RequiredObjectKeys<T> — Extracts optional or required keys from an object type.SchemaShape is not exported from the package root. It remains an implementation detail unless a concrete external use case requires a public contract.