使用包含在數組元素上的TypeScript錯誤。當然,一旦編譯成js的它工作正常,但我仍然得到以下打字稿錯誤:JavaScript的TypeScript等效包括()
Property 'includes' does not exist on type 'boolean[]'
代碼:
validAttrs() {
let valid: boolean[] = this.required.map((value, index) => {
if(this.elm.nativeElement.getAttribute(value) === null) {
return false;
};
return true;
});
return valid.includes(false) ? false : true;
}
嘗試更改'布爾[]''陣列' –
echonax
https://github.com/Microsoft/TypeScript/issues/2340 –
@echonax會有什麼不同?它們意義相同。 –