@@ -39,17 +39,18 @@ extends Omit<
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type MutableInput<
|
interface MutableInput<
|
||||||
Self,
|
Self,
|
||||||
Fields extends Schema.Struct.Fields,
|
Fields extends Schema.Struct.Fields,
|
||||||
I, R, C,
|
I, R, C,
|
||||||
Inherited,
|
Inherited,
|
||||||
Proto
|
Proto
|
||||||
> = Omit<Schema.Class<Self, Fields, I, R, C, Inherited, Proto>,
|
> extends StaticType<Schema.Class<Self, Fields, I, R, C, Inherited, Proto>> {
|
||||||
| "extend"
|
new(
|
||||||
| "transformOrFail"
|
props: any,
|
||||||
| "transformOrFailFrom"
|
options?: any,
|
||||||
>
|
): Schema.Struct.Type<Fields> & Omit<Inherited, keyof Fields> & Proto
|
||||||
|
}
|
||||||
|
|
||||||
export const Mutable = <
|
export const Mutable = <
|
||||||
Self,
|
Self,
|
||||||
|
|||||||
@@ -12,12 +12,14 @@ import { Mutable } from "./class/Mutable"
|
|||||||
// MobXObservable
|
// MobXObservable
|
||||||
// ) {}
|
// ) {}
|
||||||
|
|
||||||
class User extends Class<User>("User")({
|
const UserProto = Class<User>("User")({
|
||||||
id: S.BigIntFromSelf,
|
id: S.BigIntFromSelf,
|
||||||
role: S.Union(S.Literal("BasicUser"), S.Literal("Admin")),
|
role: S.Union(S.Literal("BasicUser"), S.Literal("Admin")),
|
||||||
}) {}
|
})
|
||||||
|
|
||||||
const MutableUser = Mutable(User)
|
class User extends UserProto {}
|
||||||
|
|
||||||
|
const MutableUser = Mutable(UserProto)
|
||||||
|
|
||||||
const JsonifiableUser = User.pipe(
|
const JsonifiableUser = User.pipe(
|
||||||
Jsonifiable(S.Struct({
|
Jsonifiable(S.Struct({
|
||||||
|
|||||||
Reference in New Issue
Block a user