Skip to content

bug: event types changed from [ComponentName]CustomEvent<number> to EventName<CustomEvent<number>> #531

Open
@jmessmer

Description

@jmessmer

Prerequisites

Stencil Version

4.22.2

Stencil Framework Output Target

React

Stencil Framework Output Target Version

0.7.4

Current Behavior

Prior to upgrading to 0.7.x, in version 0.5.3, event types name were driven (I believe) from the LocalJSX (exported as JSX) of the generated components.d.ts file, which included a nomenclature of [InterfaceName]CustomEvent.

declare namespace LocalJSX { interface MyFoo { "onMyEventTrigger"?: (event: MyFooCustomEvent<number>) -> void; } }

Now with version 0.7.x, the event type name changed to EventName<CustomEvent<number>> within the generated component.ts.

While I understand that the event is not a complex type but I don't think it should have changed from what it was before. This breaks any consumer of my library that I published. What I don't understand is that the LocalJSX still has the same event type, MyFooCustomEvent<number> as it was in the 0.5.3 version.

Expected Behavior

I would have expected the event types to be same as it was before

Steps to Reproduce

  1. Created a stencil web component with an event (non complex type) using stencil version 4.20.0
  2. Generate the react wrapper using react-output-target version 0.5.3
  3. Create a react application that uses the web component react wrapper and handles the event using typescript
  4. Upgrade the stencil library to 4.22.2 and upgrade the react-output-target to 0.7.4
  5. Upgrade the react application to use the updated web component react wrapper

Code Reproduction URL

https://github.com/foobar

Additional Information

No response

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