Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: 'ssrServerServer' implicitly has type 'any' #188

Open
slifty opened this issue Oct 10, 2022 · 2 comments
Open

bug: 'ssrServerServer' implicitly has type 'any' #188

slifty opened this issue Oct 10, 2022 · 2 comments
Labels
bug Something isn't working TypeScript

Comments

@slifty
Copy link

slifty commented Oct 10, 2022

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

  1. Create a typescript sveltekit project
  2. Set up firebase init for functions with typescript enabled
  3. Run build; follow CLI insertion instructions
  4. 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

@slifty slifty added the bug Something isn't working label Oct 10, 2022
@slifty
Copy link
Author

slifty commented Oct 10, 2022

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)

@jthegedus
Copy link
Owner

jthegedus commented Dec 14, 2022

TypeScript Functions is not yet supported by the adapter. Thanks for sharing your solution. Unfortunately, I have no ETA on TS support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants