[英]How to specify this in an object literal with flow in js
我正在使用// @flow strict
但不知何故它在使用this
時無法在對象文字中正常工作。 this
似乎被解釋為任何。
這是示例代碼
type TestType = {
arr: Array<number>,
fun: () => void,
}
const testObject: TestType = {
arr:[],
fun(){
this.arr.toUpperCase();
}
}
testObject.fun();
我如何告訴 flow 它知道this.arr.toUpperCase()
不存在,因為this.arr
是一個數組?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.