问题描述
axis: {
x: {
type: "category"
}
},
The types of 'axis.x.type' are incompatible between these types.
Type 'string' is not assignable to type '"category" | "indexed" | "log" | "timeseries"'
我找不到如何用另一种方式初始化类型。你能帮我吗?
解决方法
Cast category as const
to notify ts "category"
是 x 轴类型中 "category" | "indexed" | "log" | "timeseries"
的 const 类型之一。
const options = {
axis: {
x: {
type: "category" as const,},};