Hi I'm new to typescript react and ionic and I'm getting this error on the title, and the error Argument of type '{ artist: string; title: string; uri: string; albumUrl: string; }[]' is not assignable to parameter of type 'SetStateAction<never[]>'. in my return I'm trying to convert a javascript project to a typescript with ionic react
useEffect(() => {
if (!search) return setSearchResults([])
if (!accessToken) return
let cancel = false
spotifyApi.searchTracks(search).then(res => {
if (cancel) return
setSearchResults(
res.body.tracks.items.map(track => {
const smallestAlbumImage = track.album.images.reduce(
(smallest, image) => {
if (image.height < smallest.height) return image
return smallest
},
track.album.images[0]
)
return {
artist: track.artists[0].name,
title: track.name,
uri: track.uri,
albumUrl: smallestAlbumImage.url,
}
})
)
})
return () => (cancel = true)
}, [search, accessToken])
I found other similar cases but I couldn't apply to my code, since I could barely understand, pls help