babel-plugin-parameter-decorator icon indicating copy to clipboard operation
babel-plugin-parameter-decorator copied to clipboard

Static class methods receive the prototype as the target and not the class

Open cneuwirt opened this issue 4 years ago • 0 comments

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

cneuwirt avatar Aug 11 '20 13:08 cneuwirt