stencil icon indicating copy to clipboard operation
stencil copied to clipboard

bug: Using Angular output target, EventEmitters typed with short array type notation are not binded properly

Open tfrijsewijk opened this issue 3 years ago • 4 comments
trafficstars

Prerequisites

Stencil Version

2.10.0

Current Behavior

Using @stencil/angular-output-target:

@Component()
export class MyComponent {
  fails!: EventEmitter<MyInterface[]>;
  works!: EventEmitter<Array<MyInterface>>;
}

Gets compiled to:

import type { MyInterface as IMyComponentMyInterface } from '@library/my-library';
export declare interface LibMyComponent extends Components.LibMyComponent {
  fails: EventEmitter<CustomEvent<MyInterface>>;
  works: EventEmitter<CustomEvent<Array<IMyComponentMyInterface>>>;
}

in /packages/angular-workspace/projects/component-library/src/lib/stencil-generated/components.ts.

Expected Behavior

I would expect it to work with short array type notation:

import type { MyInterface as IMyComponentMyInterface } from '@library/my-library';
export declare interface LibMyComponent extends Components.LibMyComponent {
  worksAgain: EventEmitter<CustomEvent<MyInterface[]>>; // Or `EventEmitter<CustomEvent<Array<MyInterface>>>`, i don't mind
  works: EventEmitter<CustomEvent<Array<IMyComponentMyInterface>>>;
}

Steps to Reproduce

Follow the Angular documentation here and type an EventEmitter with short array type notation.

Code Reproduction URL

intentionally left blank

Additional Information

No response

tfrijsewijk avatar Jun 22 '22 12:06 tfrijsewijk