Before marking my question as a duplicate of "What is the prototype is JavaScript?" please note that this question is focused on the prototypes of the ES6 classes. Although the prototype chain conception is involved, the implementations of the inheritance mechanism at ES5- are off-topic.
Unfortunately, the general explanation about inheritance and the prototype chain does not give a clear answer to my question. Contrariwise, it creates new questions.
I did not care about prototypes of the classes until not tried to create the decorator (on the non-static class property). In the case of non-static class property fields, the first parameter of the decorator function is the prototype of the target class.
From the viewpoint of general explanation, the prototype of the target class is completely useless (at least I don't understand what to do with it even know that this prototype is related to some class) - what is seems to be valuable is the class itself.
export function VueReactiveField(
classPrototype: unknown, // What it this? What we can do with it?
fieldName: string
): void {
}
Moreover, the prototype has doubled the complexity. If this equation we have for variables now:
- Target class (everything is clear)
- The instance of the target class (everything is clear)
- The prototype of the target class (I don't understand its essence)
- The prototype of an instance of the target class (I don't understand its essence)