0.1.21 #21

Merged
Thilawyn merged 23 commits from next into master 2024-05-12 01:11:51 +02:00
2 changed files with 11 additions and 13 deletions
Showing only changes of commit f028fb5a32 - Show all commits

View File

@@ -55,15 +55,6 @@ export class EffectSchemaInitialTraitExpressionBuilder {
annotations?: S.Annotations.Schema<unknown>, annotations?: S.Annotations.Schema<unknown>,
) { ) {
return new EffectSchemaTraitExpressionBuilder( return new EffectSchemaTraitExpressionBuilder(
// superclass.extend<unknown>(identifier)(fields, annotations) as S.Class<
// unknown,
// Fields & NewFields,
// I & S.Struct.Encoded<NewFields>,
// R | S.Struct.Context<NewFields>,
// C & S.Struct.Constructor<NewFields>,
// InstanceType<Super>,
// Proto
// >,
superclass.extend<unknown>(identifier)(fields, annotations), superclass.extend<unknown>(identifier)(fields, annotations),
{} as Omit<StaticMembers<Super>, keyof S.Class<Self, Fields, I, R, C, Inherited, Proto>>, {} as Omit<StaticMembers<Super>, keyof S.Class<Self, Fields, I, R, C, Inherited, Proto>>,
[], [],

View File

@@ -4,6 +4,10 @@ import { EffectSchemaTraitExpression } from "./EffectSchemaTraitExpression"
import { effectSchemaExpression } from "./EffectSchemaTraitExpressionBuilder" import { effectSchemaExpression } from "./EffectSchemaTraitExpressionBuilder"
type RequiredKeys<T> = {
[K in keyof T]-?: {} extends Pick<T, K> ? never : K
}[keyof T]
type Extr<T> = type Extr<T> =
T extends EffectSchemaTraitExpression< T extends EffectSchemaTraitExpression<
infer Fields, infer Fields,
@@ -19,6 +23,10 @@ type Extr<T> =
? Static ? Static
: never : never
type InspectSchemaClass<T> = T extends S.Class<infer Self, infer Fields, infer I, infer R, infer C, infer Inherited, infer Proto>
? C
: never
const userExp = effectSchemaExpression const userExp = effectSchemaExpression
.class("User", { .class("User", {
@@ -35,9 +43,11 @@ class User extends userExp.extends<User>() implements Implements<typeof userExp>
static aStaticMethodThatShouldBeInherited() {} static aStaticMethodThatShouldBeInherited() {}
} }
type T1 = InspectSchemaClass<typeof userExp.superclass>
type T2 = InstanceType<typeof userExp.superclass>
const user = new User({ id: 0n, role: "User" }) const user = new User({ id: 0n, role: "User" })
// user.id = 0n // user.id = 0n
type UserEncoded = S.Schema.Encoded<typeof User>
const adminExp = effectSchemaExpression const adminExp = effectSchemaExpression
@@ -47,9 +57,6 @@ const adminExp = effectSchemaExpression
// .immutable() // .immutable()
.build() .build()
adminExp.superclass
type T = Extr<typeof adminExp>
@adminExp.staticImplements @adminExp.staticImplements
class Admin extends adminExp.extends<Admin>() implements Implements<typeof adminExp> { class Admin extends adminExp.extends<Admin>() implements Implements<typeof adminExp> {
} }