Next.js Discord

Discord Forum

(newbie) - Unexpected any. Specify a different type.

Unanswered
Citrus blackfly parasitoid posted this in #help-forum
Open in Discord
Avatar
Citrus blackfly parasitoidOP
Hi, I'm new to frontend languages, anyway I'm using MRT Table v3, I have the same exact page on a React test project, and it works with 0 errors

Since the project on which I need work on is made in Next.JS then I putted the same code in the .tsx page, but I get tons of errors like that in screen (and they are errors, not warnings)

Anyway if I ignore them all works fine, but I just wonder why in Next.JS this happen

Thanks all in advance
Image

1 Reply

Avatar
Flemish Giant
It looks like the issue you're encountering is related to TypeScript's type checking in Next.js.

You could define a type for your item like so:

interface Item {
id: string; // or number, depending on your data
// Add other properties here if needed
}

const data = await response.json();
return data.map((item: Item) => ({
id: item.id,
}))