sveltefire
sveltefire copied to clipboard
svelte with typescript. cannot find moudle
Hi Jeff,
Svelte typescript with lang="ts". I get the "Cannot find module 'sveltefire' or its corresponding type declarations."
thanks
The next release will have better support for TypeScript, but currently you can solve this issue by creating a file named main.d.ts
with this line:
declare module 'sveltefire';
Oh of course. Thanks. Forgot about that.
The main.d.ts
does not seem to get picked up by svelte-check
? 🤔 And inline data binds don't work. let:data={myItem}
yields the following error:Property 'key' does not exist on type 'unknown'.ts(2339)
. Any way to work around this?
@guidobouman could you share your file organization? We have just been struggling with the same issue but have solved it also with a xyz.d.ts
file in the code source.
@deemetree-at-satelligence https://github.com/Q42/hack-for-good/tree/main/web
The Svelte project sits in a web
folder. The main.d.ts
file is next to the main.ts
file.
A run of npm run validate
gives a lot of errors. This includes Error: Cannot find module 'sveltefire' or its corresponding type declarations. (ts)
, which declare module 'sveltefire';
should solve, right?
For beginners in typescript that are using sveltekit I'd just like to add that you can also add that declare module 'sveltefire';
to your src/global.d.ts
file to make the warning go away for now.