vega / react-vega

Convert Vega spec into React class conveniently
http://vega.github.io/react-vega/
Other
380 stars 67 forks source link

Add `VisualizationSpec` type to spec definition #589

Open connormcmk opened 1 year ago

connormcmk commented 1 year ago

Otherwise, user gets error:

Type '{ width: number; height: number; mark: { type: string; }; encoding: { x: { field: string; type: string; }; y: { field: string; type: string; }; }; data: { name: string; }; }' is not assignable to type 'VisualizationSpec'.
  Type '{ width: number; height: number; mark: { type: string; }; encoding: { x: { field: string; type: string; }; y: { field: string; type: string; }; }; data: { name: string; }; }' is not assignable to type 'TopLevelUnitSpec<Field>'.
    Type '{ width: number; height: number; mark: { type: string; }; encoding: { x: { field: string; type: string; }; y: { field: string; type: string; }; }; data: { name: string; }; }' is not assignable to type 'GenericUnitSpec<FacetedCompositeEncoding<Field>, AnyMark, TopLevelParameter>'.
      Types of property 'mark' are incompatible.
        Type '{ type: string; }' is not assignable to type 'AnyMark'.
          Type '{ type: string; }' is not assignable to type 'MarkDef<"bar" | "area" | "circle" | "image" | "line" | "rect" | "text" | "arc" | "point" | "rule" | "tick" | "trail" | "square" | "geoshape", ExprRef | SignalRef>'.
            Types of property 'type' are incompatible.
              Type 'string' is not assignable to type '"bar" | "area" | "circle" | "image" | "line" | "rect" | "text" | "arc" | "point" | "rule" | "tick" | "trail" | "square" | "geoshape"'.