Closed sceee closed 3 years ago
Hi @sceee, thanks for the report. I tried replicating the issue, but I wasn't able to. Please try to delete the node_modules directory and the package-lock.json file, then do npm install
again.
If the issue persists, please share a sample project that I can run locally to replicate the issue.
@looptheloop88 I tried deleting the node_modules
directory as well as the package-lock.json
but it did not help.
Here is a sample project with a build run that also emits these warnings: https://github.com/sceee/firebase-modular-reexport-demo/runs/3007852870?check_suite_focus=true#step:5:17
So it looks like there are some issues with importing then exporting Typescript types due to them disappearing after transpilation. See https://stackoverflow.com/questions/40841641/cannot-import-exported-interface-export-not-found
There seem to be 3 ways around this.
As mentioned in that link, for example, remove ActionCodeSettings
from the main firebase/auth
import list and make a separate line:
import type { ActionCodeSettings } from `firebase/auth`
This works in Typescript 3.8 and higher and removed the warning for that particular item for me.
Another method is to import and use the type in the actual file instead of doing the import/export from a main file.
I put the interfaces in a separate file (types.ts) and exported them directly, no separate import/export statements, e.g.
export { DocumentData, SnapshotOptions, FirestoreDataConverter } from 'firebase/firestore'
export { ActionCodeSettings, User as BackendAuthUser } from 'firebase/auth'
The consuming files would have to import types from `types.ts` and code from `main.ts`. It might be good for organization to keep them separate, or not, depends on your preference.
Let me know if there's anything we have to change on our end but it seems at the moment like it is a Typescript issue on the consuming end.
@hsubox76 thank you for your help. Using your mentioned first method resolves the issue and works for me!
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
Steps to reproduce:
After migrating to the modular v9 SDK, importing several interfaces from the new modular JS SDK fails. The compiler emits the following warnings:
Relevant Code:
I do not really understand this issue as when I look at the
index.d.ts
, the exports are there.