billboard.js: 'axis.x.type' 的类型在这些类型之间不兼容
billboard.js: The types of 'axis.x.type' are incompatible between these types
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
通知ts "category"
是x轴类型"category" | "indexed" | "log" | "timeseries"
的const类型之一
const options = {
axis: {
x: {
type: "category" as const,
},
},
};
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
通知ts "category"
是x轴类型"category" | "indexed" | "log" | "timeseries"
的const类型之一
const options = {
axis: {
x: {
type: "category" as const,
},
},
};