Skip to content

bug: Attribute reflected prop types causes an typescript error on components.d.ts #6183

@itsjustaplant

Description

@itsjustaplant

Prerequisites

Stencil Version

^4.27.0

Current Behavior

Attribute reflected types are generated wrong.

Expected Behavior

It should be generated without an error.

System Info

Steps to Reproduce

1- Create a component
2- Add a prop @Prop({ attribute: 'role' }) hostRole?: 'button' | 'link' = 'button';
3- Go to components.d.ts
4- interface HTMLPlantCardElement extends Components.PlantCard, HTMLStencilElement this is where the error happens.

interface PlantCard {
        "hostRole"?: 'button' | 'link';
        /**
         * @deprecated use camelCase instead. Support for dash-casing will be removed in Stencil v5.
         */
        "role"?: 'button' | 'link';
    }

Since role is not required in PlantCard interface but it is required in HTMLStencilElement and HTMLElement, it cannot be extended to both types simultaneously.

Code Reproduction URL

https://github.com/itsjustaplant/stencil-mono/tree/issue/type-generation

Additional Information

Related commit: 30f2a09

Metadata

Metadata

Labels

Bug: ValidatedThis PR or Issue is verified to be a bug within Stencil

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions