Still WIP

This commit is contained in:
barsdeveloper
2024-05-28 16:44:39 +02:00
parent 70b4cabb97
commit 1c2778fbf8
62 changed files with 2480 additions and 2853 deletions

View File

@@ -0,0 +1,22 @@
import IEntity from "./IEntity.js"
export default class ComputedTypeEntity extends IEntity {
/** @type {(entity: IEntity) => typeof IEntity} */
static f
/**
* @template {typeof ComputedTypeEntity.f} T
* @param {T} producer
*/
static from(producer) {
const result = /** @type {(typeof ComputedTypeEntity) & { f: T }} */(this.asUniqueClass())
result.f = producer
return result
}
/** @param {IEntity} entity */
compute(entity) {
return /** @type {typeof ComputedTypeEntity} */(this.Self()).f(entity)
}
}