0.1.6 #7

Merged
Thilawyn merged 10 commits from next into master 2024-07-29 18:42:05 +02:00
2 changed files with 12 additions and 9 deletions
Showing only changes of commit 1f8a92bc66 - Show all commits

View File

@@ -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,

View File

@@ -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({