sveltejs/template

Unable to import Svelte from TS

Opened this issue · 3 comments

I'm being able to import Svelte from Svelte or JS, inclusively within <script lang='ts'> context. However, importing Svelte from a script.ts file results in:

Cannot find 'C.svelte' or its corresponding type declarations.

Actually in my project I'm importing src/app/ui/EntryPoint.svelte from src/EntryPoint.ts. If I rename src/EntryPoint.ts to src/EntryPoint.js I don't get this error and the IDE properly resolves the import.

Here's the project: PhantasyStar3.

Please ask such questions on StackOverflow.

That said, the problem is that types in your tsconfig.json is missing "svelte". If you add that, the ambient type definition for Svelte files will be picked up.

Why didn't the template include it then? I don't get it, but thanks anyway.

Because it's in the base config which you extend, but you did override it.