svelte-adapter-firebase
svelte-adapter-firebase copied to clipboard
bug: 'ssrServerServer' implicitly has type 'any'
Describe the Bug
When I build the /functions directory in a project that is configured to use typescript and use the recommended CLI output I face type issues:
$ yarn --cwd ./functions run build
$ tsc
src/index.ts:6:5 - error TS7034: Variable 'ssrServerServer' implicitly has type 'any' in some locations where its type cannot be determined.
6 let ssrServerServer;
~~~~~~~~~~~~~~~
src/index.ts:8:7 - error TS7005: Variable 'ssrServerServer' implicitly has an 'any' type.
8 if (!ssrServerServer) {
~~~~~~~~~~~~~~~
Found 2 errors in the same file, starting at: src/index.ts:
This is due to the fact that the default CLI code is doing a few unsafe things (for one thing it's referencing a file that does not exist until after compile!). Even if I do move the file over it's a js file without type definitions.
Steps to Reproduce
- Create a typescript sveltekit project
- Set up firebase init for
functionswith typescript enabled - Run build; follow CLI insertion instructions
- Build the functions
Expected Behaviour
I would expect the inserted ssrServer code to either (A) be written in TypeScript or (B) include type definitions.
svelte-adapter-firebase version
0.14.4
sveltejs/kit version
1.0.0-next.488
I did fix this locally by changing
let ssrServerServer;
to
let ssrServerServer: Function;
Though this still feels pretty unsafe to me and it would be excellent typescript was more directly supported (I see #8 is already open)
TypeScript Functions is not yet supported by the adapter. Thanks for sharing your solution. Unfortunately, I have no ETA on TS support.