sveltejs / kit

web development, streamlined
https://kit.svelte.dev
MIT License
18.39k stars 1.88k forks source link

TypeScript code is not recogonized #8805

Closed xsjcTony closed 1 year ago

xsjcTony commented 1 year ago

Describe the bug

SvelteKit is not recognising TypeScript code.

This is a mini project with some modifications based on the SvelteKit official template... I added tailwindcss and settings for normal SPA (because I need the router so I used kit).

Can anyone have a look at my reproduction repo to see what I did wrong? Thanks for the help. I believe it should be my own issue since I believe there's no way that Svelte won't work with TypeScript.

Snipaste_2023-01-31_18-26-21

Reproduction

https://github.com/xsjcTony/50projects50days-svelte

Logs

No response

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i9-11900K @ 3.50GHz
    Memory: 42.50 GB / 63.84 GB
  Binaries:
    Node: 18.12.1 - C:\NodeJS\node.EXE
    Yarn: 1.22.19 - C:\NodeJS\yarn.CMD
    npm: 9.4.0 - C:\NodeJS\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (109.0.1518.69)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    @sveltejs/adapter-static: ^1.0.5 => 1.0.5
    @sveltejs/kit: ^1.3.6 => 1.3.6
    svelte: ^3.55.1 => 3.55.1
    vite: ^4.0.4 => 4.0.4

Severity

blocking all usage of SvelteKit

Additional Information

No response

kristjanmar commented 1 year ago

Just a guess, but the './types' path might be reserved because Svelte uses it for automatically typing the data returned from load functions.

Does it work if you change the name of the types file to something else?

dummdidumm commented 1 year ago

The reserved name is ./$types, so that can't be it.

I believe it's the svelte.config.ts - you need that to be a svelte.config.js, there's no TS support for that config file.

Transfering this to a discussion.