0.1.1 #2
@@ -1,52 +0,0 @@
|
|||||||
import { trait } from "@thilawyn/thilatrait"
|
|
||||||
import { JsonifiableObject } from "type-fest/source/jsonifiable"
|
|
||||||
import { z } from "zod"
|
|
||||||
|
|
||||||
|
|
||||||
export const JsonifiableSchemable = <
|
|
||||||
JsonifySchemaT extends z.ZodRawShape,
|
|
||||||
JsonifySchemaUnknownKeys extends z.UnknownKeysParam,
|
|
||||||
JsonifySchemaCatchall extends z.ZodTypeAny,
|
|
||||||
|
|
||||||
DejsonifySchemaT extends z.ZodRawShape,
|
|
||||||
DejsonifySchemaUnknownKeys extends z.UnknownKeysParam,
|
|
||||||
DejsonifySchemaCatchall extends z.ZodTypeAny,
|
|
||||||
|
|
||||||
Values extends {},
|
|
||||||
JsonifiedValues extends JsonifiableObject,
|
|
||||||
>(
|
|
||||||
jsonifySchema: z.ZodObject<
|
|
||||||
JsonifySchemaT,
|
|
||||||
JsonifySchemaUnknownKeys,
|
|
||||||
JsonifySchemaCatchall,
|
|
||||||
JsonifiedValues,
|
|
||||||
Values
|
|
||||||
>,
|
|
||||||
|
|
||||||
dejsonifySchema: z.ZodObject<
|
|
||||||
DejsonifySchemaT,
|
|
||||||
DejsonifySchemaUnknownKeys,
|
|
||||||
DejsonifySchemaCatchall,
|
|
||||||
Values,
|
|
||||||
JsonifiedValues
|
|
||||||
>,
|
|
||||||
) =>
|
|
||||||
trait(Parent => {
|
|
||||||
abstract class JsonifiableSchemable extends Parent {
|
|
||||||
abstract readonly schema: z.ZodObject<
|
|
||||||
z.ZodRawShape,
|
|
||||||
z.UnknownKeysParam,
|
|
||||||
z.ZodTypeAny,
|
|
||||||
Values,
|
|
||||||
Values
|
|
||||||
>
|
|
||||||
|
|
||||||
static readonly jsonifySchema = jsonifySchema
|
|
||||||
readonly jsonifySchema = jsonifySchema
|
|
||||||
|
|
||||||
static readonly dejsonifySchema = dejsonifySchema
|
|
||||||
readonly dejsonifySchema = dejsonifySchema
|
|
||||||
}
|
|
||||||
|
|
||||||
return JsonifiableSchemable
|
|
||||||
})
|
|
||||||
@@ -1,3 +1,2 @@
|
|||||||
export * from "./JsonifiableSchemable"
|
|
||||||
export * from "./JsonifiableSchemableClass"
|
export * from "./JsonifiableSchemableClass"
|
||||||
export * from "./makeJsonifiableSchemableClass"
|
export * from "./makeJsonifiableSchemableClass"
|
||||||
|
|||||||
Reference in New Issue
Block a user