Skip to content

Some of Echarts' internal types should be exported (eg: ElementEvent) #15284

@iuliust

Description

@iuliust

Version

5.1.2

Steps to reproduce

Try to get a reference to the ElementEvent type of echartsInstance.on(eventName, (event) => {...})

What is expected?

In a typescript project, we should be able to get the reference to the ElementEvent type, among other types.

What is actually happening?

There's no way to get a clean reference to the type


In general, a very, very limited part of Echarts' internal types are exported. This is a big problem, because when I want to declare an observable of ElementEvent, it is just impossible.
I want to be able to have the following code :

import { ElementEvent } from 'echarts';
// ...

export class ChartComponent {
  chartClickEvents = new Subject<ElementEvent>(); // Unfortunately, it's impossible because Echart's types are almost never exported...

  constructor() {
     // ...
     this.echartsInstance.on('click', event => {
        this.chartClickEvents.next(event);
     });

     this.chartClickEvents.pipe(
          tap(e => {
                  // do stuff...
           }),
     ).subscribe();
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty: easyIssues that can be fixed more easily than the average.enThis issue is in Englishtypescript

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions