Fix Function reference

This commit is contained in:
barsdeveloper
2024-06-05 15:58:55 +02:00
parent ad8305ca52
commit beccfe522a
10 changed files with 227 additions and 298 deletions

View File

@@ -212,34 +212,6 @@ export default class Utility {
return false
}
/**
* @template {Attribute | AttributeTypeDescription} T
* @param {T} value
* @returns {AttributeConstructor<T>}
*/
static getType(value) {
if (value === null) {
return null
}
if (value?.constructor === Object && /** @type {AttributeInformation} */(value)?.type instanceof Function) {
return /** @type {AttributeInformation} */(value).type
}
return /** @type {AttributeConstructor<any>} */(value?.constructor)
}
/**
* @template {Attribute} V
* @template {AttributeConstructor<V>} C
* @param {C} type
* @returns {value is InstanceType<C>}
*/
static isValueOfType(value, type, acceptNull = false) {
if (type instanceof MirroredEntity) {
type = type.getTargetType()
}
return (acceptNull && value === null) || value instanceof type || value?.constructor === type
}
/**
* @param {Number} x
* @param {Number} y