Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Angular can't handle event types in HTML-Templates after issue #4908 is released for Stencil 4.6.0 #401

Open
FabioGimmillaro opened this issue Oct 27, 2023 · 12 comments
Labels
help wanted a good issue for the community package: angular @stencil/angular-output-target package type: bug Something isn't working

Comments

@FabioGimmillaro
Copy link

Unfortunately the provided solution for issue ionic-team/stencil#4908 in Stencil 4.6.0 didn't work for me.

I'm getting following error in my Angular-Project (Version 16.2.0):
Event valueChange is not emitted by any applicable directives nor by dx-text-input element.
The compilation still works fine but I cannot get any autocompetion for my event.

I'm using following dependencies:

  • @stencil/angular-output-target: 0.8.2
  • @stencil/core: 4.6.0

The event map within my dist/types is generated properly:

interface HTMLDxTextInputElementEventMap {
        "valueChange": string;
        "valueComplete": string;
        "autocomplete": TextInputAutocompleteController;
        "selectAutocomplete": any;
        "enterPress": void;
    }
    /**
     * Form element for capturing text input.
     * @path /Form/Inputs
     * @name Text Input
     * @shortname Text
     * @icon font
     * @stable 
     * @slot-example info
     */
    interface HTMLDxTextInputElement extends Components.DxTextInput, HTMLStencilElement {
        addEventListener<K extends keyof HTMLDxTextInputElementEventMap>(type: K, listener: (this: HTMLDxTextInputElement, ev: DxTextInputCustomEvent<HTMLDxTextInputElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
        addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
        addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
        addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
        removeEventListener<K extends keyof HTMLDxTextInputElementEventMap>(type: K, listener: (this: HTMLDxTextInputElement, ev: DxTextInputCustomEvent<HTMLDxTextInputElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
        removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
        removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
        removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
    }
    var HTMLDxTextInputElement: {
        prototype: HTMLDxTextInputElement;
        new (): HTMLDxTextInputElement;
    };

Angular HTML-file

  <dx-text-input (valueChange)="onTextInputValueChanged($event.detail)"></dx-text-input>

Angular Typescript-file

  onTextInputValueChanged(detail: string) {
    console.log(detail);
  }
@ionitron-bot ionitron-bot bot added the triage label Oct 27, 2023
@rwaskiewicz rwaskiewicz added the ionitron: needs reproduction a code reproduction is needed from the issue author label Oct 27, 2023
@ionitron-bot
Copy link

ionitron-bot bot commented Oct 27, 2023

Thanks for the issue! This issue has been labeled as needs reproduction. This label is added to issues that need a code reproduction.

Please reproduce this issue in an Stencil starter component library and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed.

If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue.

For a guide on how to create a good reproduction, see our Contributing Guide.

@ionitron-bot ionitron-bot bot removed the triage label Oct 27, 2023
@anton-white
Copy link

Same here and it's been happening with angular output components in v3 too.

The IDE doesn't see the component's outputs:

image

The outputs aren't listed in the generated component:

image

After adding outputs: ['ready'] the IDE becomes satisfied.

@FabioGimmillaro
Copy link
Author

Hey guys,

I added a repository which reproduces the described issue:
https://github.com/FabioGimmillaro/stencil-test-angular-events

I followed this guide: https://stenciljs.com/docs/angular#angular-integration

@rwaskiewicz rwaskiewicz added triage and removed ionitron: needs reproduction a code reproduction is needed from the issue author labels Oct 30, 2023
@tanner-reits
Copy link
Member

Hey @FabioGimmillaro

I'm gonna move this issue over to our Framework wrappers repository as this appears to be specific to the Angular wrappers. We'll take a look and post any updates over there!

@tanner-reits tanner-reits transferred this issue from ionic-team/stencil Nov 7, 2023
@timges
Copy link

timges commented Nov 28, 2023

Any updates on this, yet?

@jtmmsg
Copy link

jtmmsg commented Nov 30, 2023

We have this same issue here using GroupUI having this as a dependency. Please get into this soon.

@jtmmsg
Copy link

jtmmsg commented Dec 21, 2023

Any updates here? This really prevents Autocompletion in IntelliJ and shows some ugly errors and prevents type safety in the events... And there are other projects like GroupUI 9.0.0 relying on your code which I have to use at work...

@adarean5
Copy link

Any updates on this issue? I'm experiencing the same problem. This makes it difficult to work with the generated components right out of the box, as it breaks type safety between my Stencil component library and the Angular application.

@rwaskiewicz
Copy link
Member

Hey folks 👋

I don't have an update for this issue at this time. We have the repo's current maintenance status posted on the README, which for posterity, is:

This project is currently maintained for the purposes of supporting the Ionic Framework. At this time, only new issues & pull requests that support the Ionic Framework will be prioritized.

At this time, I don't believe this issue has been prioritized.

@romainfrezier
Copy link

Hi there,

It would not be enough to simply add the outputs tag here?

@Component({
  selector: '${tagName}',
  changeDetection: ChangeDetectionStrategy.OnPush,
  template: '<ng-content></ng-content>',
  // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
  inputs: [${formattedInputs}],${standaloneOption}
})

To make it look something like this:

@Component({
  selector: '${tagName}',
  changeDetection: ChangeDetectionStrategy.OnPush,
  template: '<ng-content></ng-content>',
  // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
  inputs: [${formattedInputs}],outputs: [${formattedOutputs}],${standaloneOption}
})

formattedOutputs is already calculated

@christian-bromann christian-bromann added type: bug Something isn't working package: angular @stencil/angular-output-target package help wanted a good issue for the community and removed triage labels Oct 12, 2024
Copy link

ionitron-bot bot commented Oct 12, 2024

This issue has been labeled as help wanted. This label is added to issues that we believe would be good for contributors.

If you'd like to work on this issue, please comment here letting us know that you would like to submit a pull request for it. This helps us to keep track of the pull request and make sure there isn't duplicated effort.
Thank you!

@christian-bromann
Copy link
Member

Any contributions that help resolve this issue is much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted a good issue for the community package: angular @stencil/angular-output-target package type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants