itsdouges/typescript-transformer-handbook

Usage question: Modify class prototype

LukasMachetanz opened this issue · 1 comments

Hi again!

I am wondering if it is possible to adjust the prototype of a class declaration? E.g. add specific properties? If anyone has an idea I would really appreciate it.

Thanks in advance.
Greets, Lukas

hey mate!

you could always update the prototype directly? find a class references and then update the prototype next to it.

class HelloWorld{}
HelloWorld.prototype.sayHello = () => console.log('hello')

const e = new HelloWorld();
e.sayHello()
``