0.1.0 #1
24
src/tests.ts
24
src/tests.ts
@@ -22,13 +22,31 @@ const Identifiable = <ID>() => (
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const StatefulSubscription = trait<{
|
||||||
|
readonly status: (
|
||||||
|
{ _tag: "awaitingPayment" } |
|
||||||
|
{ _tag: "active", activeSince: Date, expiresAt?: Date } |
|
||||||
|
{ _tag: "expired", expiredSince: Date }
|
||||||
|
)
|
||||||
|
}>()(Super =>
|
||||||
|
class StatefulSubscription extends Super {}
|
||||||
|
)
|
||||||
|
|
||||||
|
interface ActiveStatefulSubscriptionAbstractMembers extends TraitAbstractMembers<typeof StatefulSubscription> {
|
||||||
|
readonly status: { _tag: "active", activeSince: Date, expiresAt?: Date }
|
||||||
|
}
|
||||||
|
|
||||||
|
const ActiveStatefulSubscription = trait<ActiveStatefulSubscriptionAbstractMembers>()(Super =>
|
||||||
|
class ActiveStatefulSubscription extends Super {}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
// type Test = Simplify<TraitImplInstance<ReturnType<typeof Identifiable<bigint>>>>
|
// type Test = Simplify<TraitImplInstance<ReturnType<typeof Identifiable<bigint>>>>
|
||||||
type Test1 = [
|
type Test1 = [
|
||||||
TraitAbstractMembers<ReturnType<typeof Identifiable<bigint>>>,
|
TraitAbstractMembers<typeof StatefulSubscription>,
|
||||||
TraitAbstractMembers<ReturnType<typeof Identifiable<bigint>>>
|
TraitAbstractMembers<typeof ActiveStatefulSubscription>,
|
||||||
]
|
]
|
||||||
type Test2 = MergeInheritanceTree<Test1>
|
type Test2 = Simplify<MergeInheritanceTree<Test1>>
|
||||||
|
|
||||||
const appliedIdentifiable = Identifiable<bigint>().apply({} as any)
|
const appliedIdentifiable = Identifiable<bigint>().apply({} as any)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user