This commit is contained in:
27
src/observable/ObservableSchemable.ts
Normal file
27
src/observable/ObservableSchemable.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
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
|
||||
})
|
||||
Reference in New Issue
Block a user