ObservableZodSchemaObject
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
19
src/tests.ts
19
src/tests.ts
@@ -1,6 +1,7 @@
|
||||
import { Implements } from "@thilawyn/traitify-ts"
|
||||
import { z } from "zod"
|
||||
import { ZodSchemaClass } from "./ZodSchemaClass"
|
||||
import { ObservableZodSchemaObject } from "./traits/ObservableZodSchemaObject"
|
||||
|
||||
|
||||
const TestExp = ZodSchemaClass({
|
||||
@@ -11,12 +12,14 @@ const TestExp = ZodSchemaClass({
|
||||
}),
|
||||
|
||||
defaultValues: { id: -1n },
|
||||
}).build()
|
||||
})
|
||||
.expresses(ObservableZodSchemaObject)
|
||||
.buildAnyway()
|
||||
|
||||
@TestExp.implementsStatic
|
||||
class Test extends TestExp.extends implements Implements<typeof TestExp> {}
|
||||
|
||||
Test.defaultValues
|
||||
Test.schema
|
||||
const inst = Test.create({ id: 1n, name: "" })
|
||||
console.log(inst)
|
||||
|
||||
@@ -37,3 +40,15 @@ console.log(subInst)
|
||||
// class ChildTest extends Test {}
|
||||
|
||||
// ChildTest.instantiate({ name: "" })
|
||||
|
||||
const testSchema = { schema: Test.schema }
|
||||
|
||||
declare const testGenericSchema: {
|
||||
schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, object, object>
|
||||
}
|
||||
|
||||
type U<T> = T
|
||||
|
||||
interface ExtendTest extends U<typeof testSchema> {
|
||||
schema: z.ZodObject<any, any, any, any, any>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user