Files
zod-schema-class/src/observable/ObservableSchemable.ts
Julien Valverdé 6d1eddae55
Some checks failed
continuous-integration/drone/push Build is failing
ObservableSchemable
2024-01-17 19:42:18 +01:00

28 lines
848 B
TypeScript

import { trait } from "@thilawyn/thilatrait"
import { mapValues } from "lodash-es"
import { makeObservable } from "mobx"
import { z } from "zod"
export const ObservableSchemable = trait(Parent => {
abstract class ObservableSchemable extends Parent {
abstract readonly schema: z.ZodObject<
z.ZodRawShape,
z.UnknownKeysParam,
z.ZodTypeAny,
z.objectOutputType<z.ZodRawShape, z.ZodTypeAny, z.UnknownKeysParam>,
z.objectInputType<z.ZodRawShape, z.ZodTypeAny, z.UnknownKeysParam>
>
// constructor(...args: any[]) {
// super(...args)
// makeObservable(this,
// mapValues(this.schema.shape, () => observable) as AnnotationsMap<$Config["values"], never>
// )
// }
}
return ObservableSchemable
})