Using fetch with typescript leads to Unsafe assignment of an `any` value.

Hi all, Is anyone able to tell me why I am receving this linting issue "Unsafe assignment of an any value." when trying to use fetch json response method?
export async function GetPlaylist(
ctx: TRPCContext,
playlistUrl: string,
): Promise<SpotifyApi.PlaylistObjectFull> {
const url = `${BASE_SPOTIFY_API_URL}/playlists/${ParseSpotifyPlaylistId(playlistUrl)}`;
const requestOptions = {
headers: {
Authorization: GetAccessToken(ctx),
},
};
// console.log(url);
const response = await fetch(url, requestOptions);
if (!response.ok) {
throw new Error(response.statusText);
}
const data: SpotifyApi.PlaylistObjectFull =
(await response.json()) as SpotifyApi.PlaylistObjectFull;
return data;
}
export async function GetPlaylist(
ctx: TRPCContext,
playlistUrl: string,
): Promise<SpotifyApi.PlaylistObjectFull> {
const url = `${BASE_SPOTIFY_API_URL}/playlists/${ParseSpotifyPlaylistId(playlistUrl)}`;
const requestOptions = {
headers: {
Authorization: GetAccessToken(ctx),
},
};
// console.log(url);
const response = await fetch(url, requestOptions);
if (!response.ok) {
throw new Error(response.statusText);
}
const data: SpotifyApi.PlaylistObjectFull =
(await response.json()) as SpotifyApi.PlaylistObjectFull;
return data;
}
No description
1 Reply
Aleesssino
Aleesssinoā€¢4mo ago
Net Ninja
YouTube
Build an Image Gallery with Next.js 13 #4 - Fetching Images
In this Next 13 tutorial, you'll build an interactive image gallery with Next.js 13, TypeScript & Zod. šŸš€šŸ„·šŸ¼ Get early access to this entire course now on Net Ninja Pro: https://netninja.dev/p/build-an-image-gallery-with-next-13 šŸ”„šŸ„·šŸ¼ Check out Dave Gray on YouTube: https://www.youtube.com/c/DaveGrayTeachesCode šŸ“‚šŸ„·šŸ¼ Access the course files on GitH...
Want results from more Discord servers?
Add your server