본문 바로가기

FRONT/Error

[Vue.js] Invaild prop: type check failed for prop "". Expected Object, got String with value "". 에러

 

Invaild prop: type check failed for prop "". Expected Object, got String with value "".

 

선언 한 데이터 타입과 대입 한 데이터 타입이 달라서 발생한 에러.

 

 

ex)  1.

 

Invaild prop: type check failed for prop "value". Expected Array, got Object.

 

배열로 선언 해놓고 객체로 전달 할 때.

 

 

2. 

 

Invalid prop: type check failed for prop "date". Expected Number, got String.

 

props: {
    date: {
        type: Number,
        coerce: str => Math.trunc(Date.parse(str) / 1000)
    },
},

 

숫자로 선언 해놓고 문자열로 전달 할 때.

 

 

해결하고 작성 하다 보니 기억이 안 나서,

Stack overflow의 에러 예시를 가지고 왔다.

타입 에러이기 때문에 타입 맞춰주면 해결.

 

 

 

Reference

 

https://stackoverflow.com/questions/42715136/invalid-prop-type-check-failed-for-prop

 

Invalid prop: type check failed for prop

I created a countdown with Vue.js but I am having trouble showing the values I am getting. I have two components and I have read the single file component guide from Vue but I just don't seem to

stackoverflow.com