firebase-admin-node icon indicating copy to clipboard operation
firebase-admin-node copied to clipboard

firebase-admin 5.12.0 fails to compile with tsc

Open ndkcha opened this issue 8 years ago • 9 comments

[READ] Step 1: Are you in the right place?

  • For issues or feature requests related to the code in this repository file a Github issue.

[REQUIRED] Step 2: Describe your environment

  • Operating System version: OSX 10.11.3
  • Firebase SDK version: 5.12.0
  • Library version: _____
  • Firebase Product: firebase-admin for node.js (auth, database, storage, etc)

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

What happened? How can we make the problem occur?

I'm using typescript environment to code the server on Node.js When I compile the code, it's returning with an error:

> rimraf dist && tsc --outDir dist

node_modules/firebase-admin/lib/index.d.ts(18,22): error TS7016: Could not find a declaration file for module '@google-cloud/storage'. '/<path-to-project>/node_modules/@google-cloud/storage/src/index.js' implicitly has an 'any' type.
npm ERR! code ELIFECYCLE
npm ERR! errno 2

I have the upgraded firebase-admin to the latest version (5.12.0)

"firebase-admin": "^5.12.0",

ndkcha avatar Apr 06 '18 16:04 ndkcha

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

google-oss-bot avatar Apr 06 '18 16:04 google-oss-bot

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

google-oss-bot avatar Apr 06 '18 16:04 google-oss-bot

Compiles fine for me. Make sure GCS typings (@types/google-cloud__storage package) are installed and visible to tsc. That is the typeRoots are defined correctly in the project config.

hiranya911 avatar Apr 06 '18 17:04 hiranya911

I have @types/google-cloud_storage package installed. and here is my tsconfig file. Can you check if it is correct or not?

screen shot 2018-04-06 at 1 11 50 pm

ndkcha avatar Apr 06 '18 17:04 ndkcha

I have the same issue

rwpino avatar Apr 06 '18 17:04 rwpino

You have specified types in the config. This means only reflect-metadata types are visible to the compiler.

See https://www.typescriptlang.org/docs/handbook/tsconfig-json.html

If types is specified, only packages listed will be included. For instance:

{
   "compilerOptions": {
       "types" : ["node", "lodash", "express"]
   }
}

This tsconfig.json file will only include ./node_modules/@types/node, ./node_modules/@types/lodash and ./node_modules/@types/express. Other packages under node_modules/@types/* will not be included.

hiranya911 avatar Apr 06 '18 18:04 hiranya911

Even when i add, "types": [ "reflect-metadata", "google-cloud__storage" ], it returns me the same error.

ndkcha avatar Apr 06 '18 18:04 ndkcha

I add

 "@google-cloud/storage": "^1.6.0",
 "@types/google-cloud__storage": "^1.1.7",

to my package.json with the firebase-admin

"firebase-admin": "^5.12.0",

and I m having the same issue,

my tsconfig look like

{
    "compilerOptions": {
        "outDir": "dist",
        "target": "es6",
        "module": "commonjs",
        "noImplicitAny": true,
        "experimentalDecorators": true,
        "removeComments": true,
        "preserveConstEnums": true,
        "emitDecoratorMetadata": true,
        "sourceMap": false,
        "rootDirs": [
            "src",
            "test",
            "node_modules/@types"
        ]
    },
    "exclude": [
        "node_modules"
    ]
}

in the typescript website says if you don't include typeRoots parameter the @types will be added automatically

I downgrade the library until 5.1.0 , after this one, my compilation start to fails

rwpino avatar Apr 06 '18 20:04 rwpino

For now I am skipping lib check in typescript config until we've a workaround or a fix "skipLibCheck": true,

shahidcodes avatar May 31 '20 19:05 shahidcodes