Co-authored-by: Julien Valverdé <julien.valverde@mailo.com> Reviewed-on: https://git.jvalver.de/Thilawyn/traitify-ts/pulls/24
This commit was merged in pull request #24.
This commit is contained in:
10
src/tests.ts
10
src/tests.ts
@@ -2,6 +2,7 @@ import { TraitClass } from "./Trait"
|
||||
import { trait } from "./TraitBuilder"
|
||||
import { Implements, StaticImplements, TraitExpressionClass } from "./TraitExpression"
|
||||
import { expression } from "./TraitExpressionBuilder"
|
||||
import { type } from "./util"
|
||||
|
||||
|
||||
const PrintsHelloOnNew = trait
|
||||
@@ -18,9 +19,12 @@ const PrintsHelloOnNew = trait
|
||||
type PrintsHelloOnNewClass = TraitClass<typeof PrintsHelloOnNew>
|
||||
|
||||
const Identifiable = <ID>() => trait
|
||||
.abstract(Super => class extends Super {
|
||||
declare readonly id: ID
|
||||
})
|
||||
// .abstract(Super => class extends Super {
|
||||
// declare readonly id: ID
|
||||
// })
|
||||
.abstractType(Super => type<typeof Super & {
|
||||
readonly id: ID
|
||||
}>)
|
||||
.implement(Super => class Identifiable extends Super {
|
||||
equals(el: Identifiable) {
|
||||
return this.id === el.id
|
||||
|
||||
Reference in New Issue
Block a user