Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What if your component already extends a class? #20

Open
jsdevtom opened this issue Dec 24, 2021 · 4 comments
Open

What if your component already extends a class? #20

jsdevtom opened this issue Dec 24, 2021 · 4 comments

Comments

@jsdevtom
Copy link

Thank you for this library.

I would like to ask how to handle the scenario where a component already extends another class and where that parent class cannot extend OnDestroyMixin? E.g.:

@Component({/*...*/})
class ExampleFormComponent extends TypedForm<Example> {
    // ...
}

Obviously, this just worked in previous versions of this library because there was no inheritance required.

If this is/should not be possible with this library, please say.

@romanroe
Copy link
Member

Hi @jsdevtom !

The next version could support the mixin pattern (https://www.typescriptlang.org/docs/handbook/mixins.html). However, this would require ES6 output hence this library wouldn't work in IE11 anymore. Personally, I am OK with this, but I would like to get some feedback before.

In the meantime, you could try a generic TypeScript mixin library. However, I haven't tested any with ngx-componentdestroyed.

@sengmann @kaihenzler What do you think?

@iamtheddrman
Copy link

I'll throw a vote in for dropping IE11 support if it means use of the mixin pattern. This tool has been invaluable as we upgrade our ancient AngularJS 1.5 project to Angular 14, but I just bumped into an issue with a component that needs to extend an abstract base class AND OnDestroyMixin to get the tool to work. I'm having to drop back to the old way of doing things and it's a lot less pretty/convenient.

Any insight on how a generic mixin library would work with ngx-componentdestroyed would also be much appreciated. We're a bit in over our heads over here right now.

@kaihenzler
Copy link
Member

I'll throw a vote in for dropping IE11 support if it means use of the mixin pattern. This tool has been invaluable as we upgrade our ancient AngularJS 1.5 project to Angular 14, but I just bumped into an issue with a component that needs to extend an abstract base class AND OnDestroyMixin to get the tool to work. I'm having to drop back to the old way of doing things and it's a lot less pretty/convenient.

Any insight on how a generic mixin library would work with ngx-componentdestroyed would also be much appreciated. We're a bit in over our heads over here right now.

Maybe you could have a look at this library: https://github.com/tannerntannern/ts-mixer#basic-example
We currently don't know if it works for this usecase. It might be that its incompatible with the angular compiler.

@sengmann
Copy link
Member

I am in favor of dropping the IE11 support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants