As shown in the gif, whenever I copy code or get recommended code from Cursor, the imports always show an error like “Cannot find module x or its corresponding type declarations.” Once I force a refresh, the issue resolves, but it’s really annoying. Am I the only one experiencing this?
hey! which extension are you using to show the import errors?
I disabled all my extensions and it still happens. Same issue on my windows and mac and any project.
Anything I can provide you to better troubleshoot this issue? @ericzakariasson
Any updates?
hey! sorry about the late reply. the squiggly lines after the import is an extension right?
i suspect this is something with the typescript language server and the tsconfig. could you please share the content of your tsconfig file?
As I mentioned before, extensions have nothing to do with this error. I disabled all extensions, and the same issue still occurs.
This also happens with any project I create, so it’s not related to the tsconfig
file. A freshly created React/Next.js project gives me the same errors.
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
With extensions
Without any extensions…
On re-load error gone…
I fixed this for now by setting "typescript.tsserver.experimental.enableProjectDiagnostics"
to false
.
It’s not ideal since now only opened files report errors. Hopefully, the team can eventually resolve this because it’s a big drawback for me and makes me want to go back to vs code.
Another issue I’ve noticed is that in VS Code, when I copy my component, no errors are shown. But when I use Cursor, errors are thrown for the imports and JSX for a few seconds. It’s not a huge issue, but I would rather not see that every time I copy files. I would assume these issues are relatd.
glad you found a solution to this, although it might not be optimal. i’ve tried reproducing this bug on my end, but can’t really make it happen.
i’ll pass this on internally and see if someone can repro.
we’re releasing a new version very soon which could fix some of these problems