Search code examples
javascripttypescriptsveltesveltekitsupabase

Why does Typescript throw an error when I try to create Supabase client file?


I am quite new to SvelteKit and Typescript and I've recently tried uisng Supabase with SvelteKit (Typescript) and it all went well unil all of a sudden, after few projects Typescript began compalining everytime I created a supabase.js file.

The error reads: Cannot write file 'c:/Users/x/x/src/lib/supabaseClient.js' because it would overwrite input file.

I tried moving the file to different directories, but it still wouldn't work and like I said before, this error just to not occur when I would work on some other test projects before, and now every project I want to start, throws this error. Thank you for all the answers in advance!


Solution

  • So the answer to this anomaly is that instead of naming the ending of the file with .js you have to name your files with .ts when working on a Typescript project, but of course, me being a Typescript beginner I didn't think of that. Since I changed the file ending it now works. :))