+7
.changeset/deep-boats-shave.md
+7
.changeset/deep-boats-shave.md
+7
-4
packages/lexicons/lexicons/lib/validations/index.ts
+7
-4
packages/lexicons/lexicons/lib/validations/index.ts
···
131
131
type MatcherResult = undefined | Ok<unknown> | IssueTree;
132
132
type Matcher = (input: unknown, flags: number) => MatcherResult;
133
133
134
-
type LexStandardSchema<T extends BaseSchema> = StandardSchemaV1.Props<InferInput<T>, InferOutput<T>>;
134
+
type LexStandardSchemaResult<T extends BaseSchema> = StandardSchemaV1.Result<InferOutput<T>>;
135
+
136
+
interface LexStandardSchema<T extends BaseSchema> extends StandardSchemaV1.Props<unknown> {
137
+
readonly validate: (value: unknown) => LexStandardSchemaResult<T> | Promise<LexStandardSchemaResult<T>>;
138
+
readonly types?: StandardSchemaV1.Types<InferInput<T>, InferOutput<T>>;
139
+
}
135
140
136
141
export interface BaseSchema<TInput = unknown, TOutput = TInput> {
137
142
readonly kind: 'schema';
···
379
384
}
380
385
};
381
386
382
-
const toStandardSchema = <TSchema extends BaseSchema>(
383
-
schema: TSchema,
384
-
): StandardSchemaV1.Props<InferInput<TSchema>, InferOutput<TSchema>> => {
387
+
const toStandardSchema = <TSchema extends BaseSchema>(schema: TSchema): LexStandardSchema<TSchema> => {
385
388
return {
386
389
version: 1,
387
390
vendor: '@atcute/lexicons',