@plumier/reflect
Advanced tools
Comparing version 1.0.0-canary.knwigz60.0 to 1.0.0-canary.knxxq9sl.0
@@ -77,3 +77,3 @@ import "reflect-metadata"; | ||
/** | ||
* Get generic type from decorator type("T") | ||
* Get data type of declaration in specific class based on its type specified by type("T") | ||
* @param decorator type() decorator contains generic type information | ||
@@ -88,7 +88,7 @@ * @param typeTarget The current type where the type will be calculated | ||
/** | ||
* Get generic type parameter list by generic type | ||
* Get list of generic arguments used in class | ||
* @param type the class | ||
* @returns List of generic type parameters | ||
*/ | ||
function getGenericTypeParameters(type: Class): Class[]; | ||
function getArguments(type: Class): Class[]; | ||
} |
@@ -154,3 +154,3 @@ "use strict"; | ||
/** | ||
* Get generic type from decorator type("T") | ||
* Get data type of declaration in specific class based on its type specified by type("T") | ||
* @param decorator type() decorator contains generic type information | ||
@@ -173,8 +173,8 @@ * @param typeTarget The current type where the type will be calculated | ||
throw new Error(`Unable to get type information because ${typeTarget.name} is not inherited from ${decorator.target.name}`); | ||
let templateDec = getTemplate(decorator.target); | ||
if (!templateDec) | ||
throw new Error(`${decorator.target.name} doesn't define @generic.parameter() decorator`); | ||
const [type, isArray] = helpers_1.reflection.getTypeFromDecorator(decorator); | ||
if (typeof type !== "string") | ||
throw new Error("Provided decorator is not a generic type"); | ||
let templateDec = getTemplate(decorator.target); | ||
if (!templateDec) | ||
throw new Error(`${decorator.target.name} doesn't have @generic.parameter() decorator required by generic parameter ${type}`); | ||
/* | ||
@@ -215,7 +215,7 @@ get list of parents, for example | ||
/** | ||
* Get generic type parameter list by generic type | ||
* Get list of generic arguments used in class | ||
* @param type the class | ||
* @returns List of generic type parameters | ||
*/ | ||
function getGenericTypeParameters(type) { | ||
function getArguments(type) { | ||
const genericDecorator = storage_1.getMetadata(type) | ||
@@ -227,7 +227,7 @@ .find((x) => x.kind == "GenericType" && x.target === type); | ||
throw new Error(`${type.name} is not a generic type`); | ||
return getGenericTypeParameters(parent); | ||
return getArguments(parent); | ||
} | ||
return genericDecorator.types.map(x => x); | ||
} | ||
generic.getGenericTypeParameters = getGenericTypeParameters; | ||
generic.getArguments = getArguments; | ||
})(generic = exports.generic || (exports.generic = {})); |
{ | ||
"name": "@plumier/reflect", | ||
"version": "1.0.0-canary.knwigz60.0+b7cb2c1", | ||
"version": "1.0.0-canary.knxxq9sl.0+9cdb11b", | ||
"description": "Plumier reflection module", | ||
@@ -42,3 +42,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "b7cb2c12eb1298035917e8d83c27baf4b225f2a1" | ||
"gitHead": "9cdb11b16e22dac8d49244a5823021d4510a33d1" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
73953