Firebase-admin-node: Typescript (tsc) firebase-admin has no default export

Created on 3 Jun 2018  路  3Comments  路  Source: firebase/firebase-admin-node

firebase --version
3.18.4
"firebase-admin": "^5.12.0",
"firebase-functions": "^1.0.2",
"firebase-tools": "^3.18.4",
tsc --version
Version 2.8.3

In my firebase project I have a file with following import;

file.ts

import admin from "firebase-admin";
// rest of the code

Once I run tsc I am getting following error:

  • Starting compilation in watch mode...
    functions/file.ts(1,8): error TS1192: Module '"/node_modules/firebase-admin/lib/index"' has no default export.

Is there any way to avoid the error?

Most helpful comment

OK I had to use

import * as admin from "firebase-admin";

as mentioned at https://github.com/Microsoft/TypeScript/issues/3337

All 3 comments

Hmmm this issue does not seem to follow the issue template. Make sure you provide all the required information.

Hey there! I couldn't figure out what this issue is about, so I've labeled it for a human to triage. Hang tight.

OK I had to use

import * as admin from "firebase-admin";

as mentioned at https://github.com/Microsoft/TypeScript/issues/3337

Was this page helpful?
0 / 5 - 0 ratings