babel-plugin-parameter-decorator
babel-plugin-parameter-decorator copied to clipboard
Static class methods receive the prototype as the target and not the class
I have a class that looks like
class CustomInstance {
static uniqueEmail(email, @type(Database) database) {
if (email != null && database.hasEmail(email)) {
return ${email} is already taken
;
}
}
}
function type(target, propertyKey, parameterIndex) { ... }
The first argument (target) passed to the type decorator for static method uniqueEmail receives the CustomerInstance.prototype and not the CustomerInstance class itself. This breaks managing the metadata