Skip to content

Classes decorated with @Component can not extend from a base class. Inherency is temporarily disabled for stencil components. #1127

Closed

Description

@gusterwoei

Stencil version:

I'm submitting a:

[x] bug report
[x] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/

Current behavior:

  1. Run npm start
  2. Output:
Classes decorated with @Component can not extend from a base class. Inherency is temporarily disabled for stencil components.

Expected behavior:
npm start successfully

Steps to reproduce:
Run npm start

Other information:
I went through the CHANGELOG and found out that since version 0.12.0. The compiler prevents any inheritance for @Component decorated class. I wonder why this? It seems logical for component classes to extend a base class with common non-component related logic

Activity

  1. Sanderand commented on Oct 3, 2018

    @Sanderand

    This is probably relates or duplicates #1060 (comment)

  2. kael commented on Oct 3, 2018

    @kael

    @gusterwoei AFAII, seems they removed inheritance because it doesn't work well with "tree shaking". Searching about it, I've come across that blog post: Concatenative Inheritance over Prototypal Inheritance:

    Composition a.k.a. Concatenative Inheritance

    Unlike Prototypal inheritance with standard ES5 classes, the composition allows us to copy the properties from one object to another, without retaining a reference from the original object.

    [...]

    There are two immediate benefits with this approach:

    1. The methods are reusable by other variants of the SDKs. So no more redundant or duplicate code.
    2. The imports are tree-shakable with Webpack + Babel pipeline. [...]

    Looks like another paradigm to learn.

  3. adamdbradley commented on Oct 30, 2018

    @adamdbradley
    Contributor

    We're still evaluating how to best generate components from the compiler, which is why the message is there.

  4. locked as resolved and limited conversation to collaborators on Oct 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions