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

EventEmitter type is object, should be ActiveElement #1975

Open
florestankorp opened this issue Jun 16, 2024 · 0 comments
Open

EventEmitter type is object, should be ActiveElement #1975

florestankorp opened this issue Jun 16, 2024 · 0 comments

Comments

@florestankorp
Copy link

Reproduction of the problem

<canvas (chartClick)="chartClicked($event)"> </canvas>
public chartClicked(event: { event?: ChartEvent; active?: object[] }): void {
  if (event.active && event.active.length > 0) {
    const myChartDataLabelIndex = event.active[0].index; // `Property 'index' does not exist on type 'object'.ts(2339)`
    console.log(myChartDataLabelIndex);
  }
}

Suggested fix:

libs/ng2-charts/src/lib/base-chart.directive.ts

  @Output() public chartClick: EventEmitter<{
    event?: ChartEvent;
    active?: ActiveElement[];
  }> = new EventEmitter();

  @Output() public chartHover: EventEmitter<{
    event: ChartEvent;
    active: ActiveElement[];
  }> = new EventEmitter();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant