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

undefined Output should show error in the parent template #43603

Open
urielzen opened this issue Sep 26, 2021 · 2 comments
Open

undefined Output should show error in the parent template #43603

urielzen opened this issue Sep 26, 2021 · 2 comments

Comments

@urielzen
Copy link

@urielzen urielzen commented Sep 26, 2021

Which @angular/* package(s) are relevant/releated to the feature request?

core

Description

I believe I have all the template strict checks enabled, and I was expecting to have a template error at my parent component telling me that my child component does not have certain output if there is a typo in its name.

@Component({
  selector: 'app-child',
  templateUrl: './child.component.html'
})
export class ChildComponent {
  @Output() outputFromChild = new EventEmitter<string>();
}
<app-child (outputFromChildWithATypo)="handleOutputAtParent($event)"></app-child>

Proposed solution

The compiler should warn about a non-existing output in the component element.

Alternatives considered

Please let me know if this error check already exists, I may just be missing enabling it. I tried googling for it but could not find anything relevant.

@JoostK
Copy link
Member

@JoostK JoostK commented Sep 27, 2021

There is indeed a gap in type-checking here. The misnamed output does have a valid target though: the app-child DOM element that is rendered. We don't currently check output against the DOM schema, so any unknown output is not reported.

You can partially workaround using "strictDomEventTypes": true, as that would have made $event of the DOM's native Event type.

@ngbot ngbot bot added this to the Backlog milestone Sep 27, 2021
@ngbot ngbot bot added this to the Backlog milestone Sep 27, 2021
@ngbot ngbot bot added this to the Backlog milestone Sep 27, 2021
@angular-robot
Copy link

@angular-robot angular-robot bot commented Sep 27, 2021

This feature request is now candidate for our backlog! In the next phase, the community has 60 days to upvote. If the request receives more than 20 upvotes, we'll move it to our consideration list.

You can find more details about the feature request process in our documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants