Work
This commit is contained in:
@@ -1,15 +1,18 @@
|
||||
import type { Class, Struct } from "@effect/schema/Schema"
|
||||
import type { Struct } from "@effect/schema/Schema"
|
||||
import { makeObservable, observable, type CreateObservableOptions } from "mobx"
|
||||
import { mapValues } from "remeda"
|
||||
import type { Constructor } from "type-fest"
|
||||
|
||||
|
||||
export function MobXObservable<
|
||||
C extends Class<any, Struct.Fields, any, any, any, any, any>
|
||||
This extends Constructor<Struct.Type<Struct.Fields>, any> & {
|
||||
readonly fields: { readonly [K in keyof Struct.Fields]: Struct.Fields[K] }
|
||||
}
|
||||
>(
|
||||
class_: C,
|
||||
class_: This,
|
||||
options?: Omit<CreateObservableOptions, "proxy">,
|
||||
) {
|
||||
return class MobXObservable extends (class_ as Class<any, Struct.Fields, any, any, any, any, any>) {
|
||||
return class MobXObservable extends class_ {
|
||||
declare ["constructor"]: typeof MobXObservable
|
||||
|
||||
constructor(...args: any[]) {
|
||||
@@ -20,5 +23,5 @@ export function MobXObservable<
|
||||
options,
|
||||
)
|
||||
}
|
||||
} as C
|
||||
} as This
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user