This commit is contained in:
22
src/tests.ts
22
src/tests.ts
@@ -1,5 +1,7 @@
|
||||
import { Call } from "hotscript"
|
||||
import { Implements, TraitExpressionTraitsFn, abstract, expression, trait } from "."
|
||||
import { Call, ComposeLeft, Pipe } from "hotscript"
|
||||
import { Implements, TraitExpressionAbstractFn, TraitExpressionTraitsFn, abstract, expression, trait } from "."
|
||||
import { Simplify } from "type-fest"
|
||||
import { SimplifyFn } from "./util"
|
||||
|
||||
|
||||
const PrintsHelloOnNew = trait(
|
||||
@@ -59,9 +61,23 @@ const builder = expression
|
||||
)
|
||||
|
||||
const exp = builder.get()
|
||||
type Abs = Call<TraitExpressionTraitsFn, typeof exp>
|
||||
type Abs = Call<ComposeLeft<[
|
||||
TraitExpressionAbstractFn,
|
||||
SimplifyFn,
|
||||
]>, typeof exp>
|
||||
|
||||
exp.subtrait(
|
||||
s => {
|
||||
interface Subtrait extends (typeof s) {
|
||||
|
||||
}
|
||||
|
||||
return abstract<Subtrait>()
|
||||
},
|
||||
)
|
||||
|
||||
class User extends exp.extends implements Implements<typeof exp> {
|
||||
declare status: { _tag: "awaitingPayment" } | { _tag: "active"; activeSince: Date; expiresAt?: Date | undefined } | { _tag: "expired"; expiredSince: Date }
|
||||
id: bigint = -1n
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user