Skip to content
Advertisement

How to extend class type with decorator

I’d like to use decorators in my project. Here’s what I have written:

JavaScript

As you see this decorators creates a few fields. But typescript can’t recognize them

JavaScript

It does exsist though. If I add @ts-ignore before using these parameters, the code works okay.

I wounder, how can I create a class decorator, that would extend parent’s type. I tried to do something like this:

JavaScript

But it didn’t help.

Any ideas?

Advertisement

Answer

The answer is in the TypeScript docs of the Class decorators:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement