CJS vs ESM import issue?
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- node.js, typescript
Research direction
Start by reproducing the reported assignment error in a Firebase Cloud Functions TypeScript project using ESM, Node.js 20.13.1, firebase-admin 12.5.0, and the shown Node16 tsconfig. Compare the CJS and ESM @google-cloud/storage File types and the discussion linked in the issue; done means the cause and an appropriate project-level resolution are established.
Written by the indexing model from the issue text.
Description
[READ] Step 1: Are you in the right place?
Yes
[REQUIRED] Step 2: Describe your environment
- Operating System version: MacOS 15.4.1
- Firebase SDK version: firebase-admin 12.5.0
- Firebase Product: storage
- Node.js version: 20.13.1
- NPM version: 10.8.0
[REQUIRED] Step 3: Describe the problem
Basically what happened here. It's just there has been no answer to that, only workaround, so I post it here.
Happened to me when importing:
import type { File } from "@google-cloud/storage";
It says:
TS2322: Type
import("/WebstormProjects/firebase/functions/node_modules/@google-cloud/storage/build/cjs/src/file").File
is not assignable to type
import("/WebstormProjects/firebase/functions/node_modules/@google-cloud/storage/build/esm/src/file", { with: { "resolution-mode": "import" } }).File
Property #private in type File refers to a different member that cannot be accessed from within type File
Steps to reproduce:
Create Firebase Cloud Functions project using typescript and ESM.
Relevant Code:
tsconfig:
"module": "Node16",
"moduleResolution": "Node16",
"target": "es2020",
- Dominant language
- TypeScript
- Stars
- 1.7k
- Forks
- 419
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 16
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from firebase/firebase-admin-node
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
firebase/firebase-admin-node#3234 ·
-
firebase/firebase-admin-node#3221 · 3 comments · 1 assignee ·
-
api: messaging
Difficulty 3/5 1-2 days Newbie friendliness 70/100
firebase/firebase-admin-node#3215 ·
-
api: messaging
Difficulty 5/5 Over a week Newbie friendliness 28/100
firebase/firebase-admin-node#3214 ·
-
api: firestore type: feature request
firebase/firebase-admin-node#3183 · 1 comment · 1 assignee ·
All issues in firebase/firebase-admin-node
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
mksglu/context-mode#1200 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
anthropics/claude-code#96687 ·
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
AOSSIE-Org/DebateAI#582 · 2 comments ·