Open romaindurand opened 18 hours ago
This is intended behavior. Think about it: Can you import a TypeScript file into a JavaScript file, then run that JavaScript file without using TypeScript?
There is no $lib/index.js
file for you to be importing - there's an index.ts
. I'm actually surprised that adding lang="ts"
changes the resolution logic so that $lib/index.js
can resolve to index.ts
.
Describe the bug
Hi ! I don't know if this is a bug or if this is intended but when I import a module in a page, I get an error if the module is a
.ts
file and I dont put alang="ts
in my<script>
.There's no TS syntax in the
<script>
or in the imported module.Adding
lang="ts"
in thesrc/routes/+page.svelte
<script>
fixes the issue.I usually put
lang="ts
in all my scripts but the autoimport feature in vscode creates a simple<script></script>
if there are none so this took me some time to figure outReproduction
Here's a small reproduction repro : https://github.com/romaindurand/repro-svelte-ts-import-error
Logs
System Info
Severity
annoyance