Search code examples
javascriptnode.jsvegastenciljsvega-lite

Vega Charts is throwing type definition error


I am trying to use Vega charts in my StencilJS project. When I import vega-embed in my component, it throws the following errors in the build process:

[ ERROR ]  TypeScript: ./node_modules\vega-lite\build\src\axis.d.ts:5:47
           Type 'BaseAxis' is not generic.

      L4:  import { LayoutAlign } from './vega.schema';
      L5:  declare type BaseAxisNoSignals = AxisMixins & BaseAxis<number, number, boolean, number | boolean, string, Col

      L6:  declare type VgAxisConfigNoSignals = BaseAxisNoSignals;

[ ERROR ]  TypeScript: ./node_modules\vega-lite\build\src\axis.d.ts:119:63
           A type predicate's type must be assignable to its parameter's type. Type 'string | number' is not assignable
           to type 'string'. Type 'number' is not assignable to type 'string'.

    L118:  }

This is how, I am trying to import it in my tsx file:

import embed, * as vegaEmbed from 'vega-embed'

Any help would be appreciated.


Solution

  • Kindly upgrade the version of vega-lite. This has been fixed in vega-lite 4.0.0-beta.10