Angular 9 tslint no output rename
Asked Answered
T

2

7

I'm using the @Output decorator in an angular 9 project and the code this this:

@Output('myMethod') myMethod: EventEmitter<any> = new EventEmitter();

Typescript gives my an error and forces me to add this about the code in order to remove the error:

// tslint:disable-next-line:no-output-rename

How can I fix this without having to disable the rule?

Tailrace answered 27/5, 2020 at 13:59 Comment(1)
Do your really need the 'myMethod' passed to @Output, this is already the name of the field so not necessary. The tslint rule is meant to enforce naming the field as you want the property to be seen in templates rather than renaming via the decoratorTrinatrinal
A
7

This is just a tslint warning. To fix it you should not rename the output.

Try to do something like this:

 @Output() myMethod: EventEmitter<any> = new EventEmitter();

Anderson answered 27/5, 2020 at 14:7 Comment(0)
W
1
@Output() myMethod: EventEmitter<any> = new EventEmitter();
Washwoman answered 27/5, 2020 at 14:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.