Files
ueblueprint/js/entity/MirroredEntity.js
barsdeveloper fdd86ce5de Refactor jsdoc types (#16)
* WIP

* Fix type 1

* Missing types info

* Some fixes

* Several types refactoring and fixes

* WIP

* Fix grammar
2023-09-22 22:56:33 +02:00

37 lines
710 B
JavaScript

export default class MirroredEntity {
static attributes = {
type: {
ignored: true,
},
key: {
ignored: true,
},
getter: {
ignored: true,
},
}
/**
* @param {EntityConstructor} type
* @param {String} key
*/
constructor(type, key, getter = () => null) {
this.type = type
this.key = key
this.getter = getter
}
get() {
return this.getter()
}
getTargetType() {
const result = this.type.attributes[this.key].type
if (result instanceof MirroredEntity) {
return result.getTargetType()
}
return result
}
}