안녕하세요, 즐겁고 유익하게 강의 잘듣고있습니다.
이번 실습의 예제코드에서
'contacts' 와 'this.contacts'에 오류가 발생됩니다.
이런 오류는 어떻게 해결하나요?
return new Promise((resolve) => {
setTimeout(() => resolve(contacts), 2000);
});
'Contact[]' 형식의 인수는 'Contact | PromiseLike<Contact>' 형식의 매개 변수에 할당될 수 없습니다.
'then' 속성이 'Contact[]' 형식에 없지만 'PromiseLike<Contact>' 형식에서 필수입니다.
fetchData(): void {
fetchContacts().then((response) => {
this.contacts = response;
});
}
//Type 'Contact' is missing the following properties from type
'Contact[]': length, pop, push, concat, and 16 more