javascriptangulartypescriptechartsngx-echarts

Does the echarts instance have a type defined for Typescript?


Does echarts provide a type for the echarts instance? I currently have it typed as any:

  /**
   * The echarts instance.
   */
  echartsIntance: any;

Curious if it has an actual type like the options do?


Solution

  • You need to install @types/echarts.

    npm i @types/echarts

    and to use it, you need to import it like this:

    import { EChartsOption } from "echarts";
    
    const options: EChartsOption = {
      /* YOUR OPTIONS */
    }