Change `constructor` to `own` on metadata
Closed this issue · 0 comments
pzuraq commented
The constructor
property is currently used to hold the metadata for the class itself, should class decorators add metadata. This property name conflicts with the constructor
name used for actual classes, and could cause confusion. It also is not very flexible for future extensions, such as function decorators.
own
captures the same overall meaning here - it is the metadata of the object which is being decorated. It also can be used in the future if, for instance, we were to add function or object decorators. You could imagine it working pretty well alongside parameter decorators as well:
// Class metadata shape
const classMetadata = {
own: '',
params: [],
public: {},
private: [],
};
const functionMetadata = {
own: '',
params: [],
};