Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

CJS vs ESM import issue?

Open
#2,914 0 comments 3 reactions 0 assignees View on GitHub

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
Domain
backend, cloud

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

api: storage
[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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from firebase/firebase-admin-node

All issues in firebase/firebase-admin-node

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.