에러노트

[에러노트] No overload matches this call.

자바칩 프라푸치노 2021. 11. 24. 19:15

문제발생

문제발생은 vue2에서 composition api 를 불러와서 잘 작업하고나서 

script 를 타입스크립트로 바꿔줄때 나타났다. 

root.$router.replace({ query: queries.value })

 

여기서 query부분이 에러가 났다. 

 

메세지는 

No overload matches this call

 

 

문제 해결

queries 의 타입은 내가 따로 지정한 타입인데 object안에 string도 있고 number도 있는 타입이었다. 

문제 발생 원인은 query의 값들은 모두 string이거나 null이거나 undefined 이어야하는데 내가 number로 지정해서 생긴 오류였다.

 

 query?: Dictionary<string | (string | null)[] | null | undefined>

그래서 타입을 모두 string으로 바꿔주었더니 해결!

 

type QueryItem = {
    apple?: string,
    // eslint-disable-next-line camelcase
    per_apple?: string,
    yellow?: string,
    red?: string,
}
728x90