본문 바로가기
오류

Property 'id' does not exist on type 'never'. ts

by 신방동불주먹 2024. 1. 30.

Typescipt 사용 시 불러오는 데이터의 명확한 데이터 타입을 모르는 경우 발생.

 

 

 

보통 빈 배열을 가진 useState 변수를 만들어주는데,

const yearlyItems = ref([]);

 

 

아래처럼 타입을 any로 바꿔주면 된다. 

 const yearlyItems = ref<any[]>([]);