Vscode - Cannot find module './App.svelte' or its corresponding type declarations.

See original GitHub issue

Describe the bug

When the extension installed after scaffolding a project if I open main.js, vs code complains about the error even though everything is perfectly working and valid.

Reproduction

npm init vite my-app -- --template svelte
cd my-app
npm install
npm run dev

And open VS Code.

Expected behaviour

Should not complain

System Info

Windows 10 VS Code: 1.69.0 Svelte for VS Code v105.18.1

Which package is the issue about?

Svelte for VS Code extension

Additional Information, eg. Screenshots

image

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
Coreusacommented, Oct 28, 2022

Experienced the same with a fresh install with Svelte (Typescript) via Yarn 2. Adding this in svelte.config.js fixed the issue temporarily, but doing changes in files outlines errors again:

/** @type {import('@sveltejs/kit').Config} */
const config = {
	// Consult https://github.com/sveltejs/svelte-preprocess
	// for more information about preprocessors
	preprocess: preprocess(),
	"enable-ts-plugin": true, **<-- THIS ONE**
	kit: {
		adapter: adapter()
	}
};

The installation was fresh, so this is still a bug and not fixed.

3reactions
jasonlyu123commented, Jul 12, 2022

Ah right. that’s the problem. We indeed didn’t check the config in the “remove the ambient type definitions” logic. Ironically what I said you can try is the actual reproduction of the problem. Sorry I didn’t check it more.

Read more comments on GitHub >

github_iconTop Results From Across the Web

19 - Stack Overflow
Plugin typescript: @rollup/plugin-typescript TS2307: Cannot find module './App.svelte' or its corresponding type declarations. Here's my package ...
Read more >
r/sveltejs - Reddit
Cannot find module './App.svelte'. I'm using JavaScript (not TS) and also have the Svelte VS Code extension installed.
Read more >
cannot find module or its corresponding type declarations
To solve the "Cannot find module `fs` or its corresponding type declarations" error, install the types for node by running the command `npm...
Read more >
1 - Code Grepper
(!) Plugin typescript: @rollup/plugin-typescript TS2307: Cannot find module './App.svelte' or its corresponding type declarations. src/main ...
Read more >
TypeScript support in Svelte - Learn web development
Just take into account that the Svelte community is constantly improving ... type checking in vs code - App object has been given...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found