ionic-team / stencil-ds-output-targets

These are output targets that can be added to Stencil for React and Angular.
https://stenciljs.com
MIT License
247 stars 112 forks source link

bug: @Event type is incorrectly generated when it emits it as an array #312

Open scaljeri opened 1 year ago

scaljeri commented 1 year ago

Prerequisites

Stencil Version

2.19.2

Stencil Framework Output Target

Angular

Stencil Framework Output Target Version

0.4.0

Current Behavior

If a Stencil Components contains

   myEvent: EventEmitter<CustomEvent<IMyData>>;
   myEventArr: EventEmitter<CustomEvent<IMyData[]>>;  // <-- This one goes wrong!!!!!

The generated output in the proxies.ts file is now as follows

import type { IMyData as IMyFooIMyData } from '@web-components/dist/components';
export declare interface MyFoo extends Components.MyFoo {
    myEvent: EventEmitter<CustomEvent<IMyFooIMyData>>;
    myEventArr: EventEmitter<CustomEvent<IMyData[]>>;
}

So, as soon as the event emits an array of some type, the generated code uses the original name of the interface and not the mapped type.

Expected Behavior

For the generated code, it should have generated

    myEventArr: EventEmitter<CustomEvent<IMyFooIMyData[]>>;

Steps to Reproduce

See above

Code Reproduction URL

https://github.com/scaljeri/stenciljs-angular-bug.git

Additional Information

No response

scaljeri commented 1 year ago

Any progress on this issue?

jdevillard commented 1 year ago

Hello have you tried with the v 0.5.0 ?

tfrijsewijk commented 1 year ago

@scaljeri Have you seen my issue https://github.com/ionic-team/stencil-ds-output-targets/issues/283 ? Could you try

myEventArr: EventEmitter<CustomEvent<Array<IMyData>>>; // Instead of EventEmitter<CustomEvent<IMyData[]>>