【发布时间】:2019-03-07 16:33:24
【问题描述】:
如何防止从数字到数组的隐式转换?
@Component
export default class FeedbackMain extends Vue {
currentState : Number = 0;
mounted () {
this.currentState = "Hello" // Type '"Hello"' is not assignable to type 'Number'
this.currentState = data.filter(d => d.statetype === 0).map(d => d.state) // Not complaining
}
【问题讨论】:
-
将
currentState改为输入any 怎么样? -->currentState: any;
标签: typescript vue.js