0
axis: {
    x: {
      type: "category"
    }
  },

I got error:

The types of 'axis.x.type' are incompatible between these types.
    Type 'string' is not assignable to type '"category" | "indexed" | "log" | "timeseries"'

I cannot find how i can init type with another way. Could you please help me?

Lola
  • 2,591
  • 6
  • 24
  • 49

1 Answers1

2

Cast category as const to notify ts "category" is one of the const types of "category" | "indexed" | "log" | "timeseries" in x axis type.

const options = {
  axis: {
    x: {
      type: "category" as const,
    },
  },
};
Mic Fung
  • 5,404
  • 2
  • 7
  • 17