UNPKG

@stainless-code/layers

Version:

Headless, UI-agnostic layer/stack manager for modal/dialog/drawer/popover/toast UI. Call a layer like an async function and await its response.

45 lines (44 loc) 1.45 kB
/** * Minimal vendored Standard Schema v1 types. * Vendoring keeps schema integration type-only and avoids a runtime dependency. * * @see https://standardschema.dev */ export interface StandardSchemaV1<Input = unknown, Output = Input> { readonly "~standard": StandardSchemaV1.Props<Input, Output>; } export declare namespace StandardSchemaV1 { export interface Props<Input = unknown, Output = Input> { readonly version: 1; readonly vendor: string; readonly validate: ( value: unknown, ) => Result<Output> | Promise<Result<Output>>; readonly types?: Types<Input, Output> | undefined; } export type Result<Output> = SuccessResult<Output> | FailureResult; export interface SuccessResult<Output> { readonly value: Output; readonly issues?: undefined; } export interface FailureResult { readonly issues: ReadonlyArray<Issue>; } export interface Issue { readonly message: string; readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined; } export interface PathSegment { readonly key: PropertyKey; } export interface Types<Input = unknown, Output = Input> { readonly input: Input; readonly output: Output; } export type InferInput<Schema extends StandardSchemaV1> = NonNullable< Schema["~standard"]["types"] >["input"]; export type InferOutput<Schema extends StandardSchemaV1> = NonNullable< Schema["~standard"]["types"] >["output"]; }