-
Notifications
You must be signed in to change notification settings - Fork 892
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
Cannot import type?? import { DocumentData } from "firebase/firestore"; #8273
Comments
Hi @ChurikiTenna, thank you for bringing this to our attention. I was able to reproduce the behavior mentioned. I'll raise it to our Firestore team or bring someone here that can provide more context about it. I’ll update this thread if I have any information to share. |
tl;dr I'm pretty sure that using What is happening is that the import
is being emitted verbatim into the resulting JavaScript as this:
The thing is, By changing the import to
this enables using it in the TypeScript code to be used for compile-time type checking but correctly omits the import from the compiled JavaScript. This is the CORRECT thing to do for any types that you import that are only used for type checking. I'm going to close this issue since this does not appear to be a bug in this GitHub repository. But feel free to continue the discussion if you think otherwise. |
Operating System
Mac
Browser Version
Safari
Firebase SDK Version
9.15.0
Firebase SDK Product:
Firestore
Describe your project's tooling
Nuxt3 with vues
Describe the problem
When I try to get DocumentData type like this in due file,
These seem to not produce any errors:
import { DocumentData } from "@firebase/firestore-types";
import type { DocumentData } from "firebase/firestore/lite";
Though it fails on localhost page.
It fails with
Module '"firebase/firestore"' has no exported member 'DocumentData'.ts(2305)
.Where can I import DocumentData from??
Steps and code to reproduce issue
install firebase v9 modules, then try to impoty DocumentData as below:
import { DocumentData } from "firebase/firestore";
The text was updated successfully, but these errors were encountered: