tannerntannern / ts-mixer

A small TypeScript library that provides tolerable Mixin functionality.
MIT License
384 stars 27 forks source link

Using custom interface in abstract extended class #45

Closed JacopoSciampi closed 2 years ago

JacopoSciampi commented 2 years ago

Hi, first of all thank you for this amazing library.

I was wondering if would be possible to extend an abstract class (along with some others) that needs a T. For example:

export abstract class MyAbstractClass<T> { ... }

and then in the main component :

export class MyComponent extends Mixin(MyAbstractClass<string>, foo, bar, ...) { ... }

Maybe I'm missing something but I can't figure how to do it.

The error given is:

Value of type 'typeof MyAbstractClass' is not callable. Did you mean to include 'new'?

tannerntannern commented 2 years ago

Hi @JacopoSciampi,

I think you're looking for this section of the README: https://github.com/tannerntannern/ts-mixer#mixing-generic-classes

🙂