Static abstract
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Julien Valverdé
2024-02-09 14:30:10 +01:00
parent 1a88ceb296
commit e31ddeaa6e
4 changed files with 81 additions and 50 deletions

View File

@@ -1,10 +1,11 @@
import { Trait, trait } from "./Trait"
import { Implements } from "./TraitExpression"
import { Implements, StaticImplements } from "./TraitExpression"
import { expression } from "./TraitExpressionBuilder"
import { abstract } from "./abstract"
const PrintsHelloOnNew = trait(
abstract(),
abstract(),
Super => class PrintsHelloOnNew extends Super {
static readonly isPrintsHelloOnNew = true
@@ -19,6 +20,7 @@ type PrintsHelloOnNewClass = Trait.Class<typeof PrintsHelloOnNew>
const Identifiable = <ID>() => trait(
abstract<{ readonly id: ID }>(),
abstract(),
Super => class Identifiable extends Super {
equals(el: Identifiable) {
return this.id === el.id
@@ -35,6 +37,7 @@ const StatefulSubscription = trait(
{ _tag: "expired", expiredSince: Date }
)
}>(),
abstract(),
Super => class StatefulSubscription extends Super {},
)
@@ -53,6 +56,8 @@ const ActiveStatefulSubscription = expression
return abstract<IActiveStatefulSubscription>()
},
exp => abstract<StaticImplements<typeof exp>>(),
Super => class ActiveStatefulSubscription extends Super {},
)
@@ -86,7 +91,9 @@ class User extends exp.extends implements Implements<typeof exp> {
console.log(new User())
declare function StaticImplements(target: { issou: string }, context: any): typeof target
declare function StaticImplements(target: { issou: string }, context: any): void
@StaticImplements
class Gneugneu {}
class Gneugneu {
// static issou: string = "juif"
}