Skip to content

Webstorm doesn't recognize imports: has no exported member #4381

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

Closed
RaviH opened this issue Feb 2, 2021 · 15 comments
Closed

Webstorm doesn't recognize imports: has no exported member #4381

RaviH opened this issue Feb 2, 2021 · 15 comments

Comments

@RaviH
Copy link

RaviH commented Feb 2, 2021

[REQUIRED] Describe your environment

  • Operating System version: Mac OS Catalina
  • Browser version: Brave 1.19.88
  • Firebase SDK version: ^0.900.11
  • Firebase Product: firebase/app

[REQUIRED] Describe the problem

Steps to reproduce:

Import dependencies into a Typescript file and you would notice imports not being recognized:

image

Relevant Code:

import { initializeApp } from 'firebase/app';
import { getAuth } from 'firebase/auth';
import { getStorage } from 'firebase/storage';
@RaviH RaviH added the alpha label Feb 2, 2021
@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@RaviH RaviH changed the title Webstorm doesn't recognize imports. Webstorm doesn't recognize imports: has no exported member Feb 2, 2021
@Feiyang1
Copy link
Member

Feiyang1 commented Feb 2, 2021

That's weird. Can you try to do a clean install - delete node_modules/ and npm install again?

@RaviH
Copy link
Author

RaviH commented Feb 3, 2021

@Feiyang1 So I deleted node_modules and yarn.lock and removed firebase from package.json, then ran yarn add firebase@exp. That seems to have helped.

Now I get this:

image

I will try to create a brand new project and see if it happens there. I might be getting old firebase from another dependency.

@Feiyang1
Copy link
Member

Feiyang1 commented Feb 3, 2021

Great. It does look like you have multiple versions of Firebase. Yeah, the old firebase can't be used with the new one side by side, so make sure you are not pulling the old firebase in the project.

@RaviH
Copy link
Author

RaviH commented Feb 5, 2021

Hello, I am trying to work on my firebase-functions module but can't find docs here: https://modularfirebase.web.app/common-use-cases/functions/ as to how to use firebase-admin with firebase-functions. Is that not a possibility right now or are the docs missing?

@RaviH
Copy link
Author

RaviH commented Feb 5, 2021

Also, another issue:

image

import { getApp } from "firebase/app";
import { getFunctions } from "firebase/functions";

const functions = getFunctions(getApp());

Then I can't use:

functions.firestore.document('/questions/{questionId}').onCreate(

@hsubox76
Copy link
Contributor

hsubox76 commented Feb 5, 2021

The functions from firebase/functions (part of the firebase client-side package) is completely different from firebase-functions, which is a separate npm package for writing functions code for the server. firebase-functions does not have a modularized version, and you should continue to use it the same way you have in the past, hopefully in a separate directory (it's usually installed in a subdirectory of your main project, if you use firebase-cli).

firebase/functions (client-side) pretty much does only one thing, which is call httpsCallable functions that you wrote and deployed using the actual firebase-functions library.

@RaviH
Copy link
Author

RaviH commented Feb 5, 2021

Thank you @hsubox76. That's very helpful to know.

I am not sure if there would be a good way to distinguish it in the names like may be firebase/functions-client.

Regardless your comment above is really helpful!

@RaviH
Copy link
Author

RaviH commented Feb 5, 2021

Another error below that occurs from this import: import { Timestamp } from 'firebase/firestore'; or the usage of Timestamp

  startDateTime: Date | Timestamp | null,
  endDateTime: Date | Timestamp | null,
node_modules/@firebase/firestore/dist/exp/index.d.ts:858:53 - error TS2315: Type 'LoadBundleTask' is not generic.

858     catch<R>(onRejected: (a: FirestoreError) => R | LoadBundleTask<R>): Promise<R | LoadBundleTaskProgress>;
                                                        ~~~~~~~~~~~~~~~~~

node_modules/@firebase/firestore/dist/exp/index.d.ts:866:65 - error TS2315: Type 'LoadBundleTask' is not generic.

866     then<T, R>(onFulfilled?: (a: LoadBundleTaskProgress) => T | LoadBundleTask<T>, onRejected?: (a: FirestoreError) => R | LoadBundleTask<R>): Promise<T | R>;
                                                                    ~~~~~~~~~~~~~~~~~

node_modules/@firebase/firestore/dist/exp/index.d.ts:866:124 - error TS2315: Type 'LoadBundleTask' is not generic.

866     then<T, R>(onFulfilled?: (a: LoadBundleTaskProgress) => T | LoadBundleTask<T>, onRejected?: (a: FirestoreError) => R | LoadBundleTask<R>): Promise<T | R>;
                                                                                                                               ~~~~~~~~~~~~~~~~~

@RaviH
Copy link
Author

RaviH commented Feb 5, 2021

I was able to move forward by using import { Timestamp } from 'firebase/firestore/lite';

Now I can't find: firebase.messaging.isSupported?

@Feiyang1
Copy link
Member

@zwu52 I don't see isSupported() in the API. Should it be added?

@zwu52
Copy link
Member

zwu52 commented Feb 11, 2021

Yes probably should be added. Seems isSupported was used in both window and sw context. If that's the case, I think we should not move forward w/ #4446 but just export directly.

@RaviH
Copy link
Author

RaviH commented Feb 12, 2021

@zwu52 Seems like we are saying that isSupported should be added. Should we create a new ticket for that?

@Feiyang1
Copy link
Member

@zwu52 I think we should keep running the checks internally, because we still want to warn people if messaging is used in an unsupported environment.

@RaviH yes, can you please create a FR for adding isSupported(), and close this one?

@RaviH
Copy link
Author

RaviH commented Feb 13, 2021

@Feiyang1 Added #4474 and closing this ticket

@RaviH RaviH closed this as completed Feb 13, 2021
@firebase firebase locked and limited conversation to collaborators Mar 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants