I have a component which displays data and also emit event on a click (after doing some calculation on it)
So display.component
type ClickEvent = {
data: any, //<-- it should be same as @input data
something: number;
}
export class DisplayComponent{
@Input() data: any;
@Output() clicked = new EventEmitter<ClickEvent>()
buttonClicked(){
this.clicked.emit({data: this.data , something: 2})
}
}
I want to make sure that the @Output and @Input are of same type. So the the user can use intellisense to access the $event which is being sent as this.clicked.emit(this.data)