node_modules/firebase-functions/lib/function-configuration.d.ts:4:64 - error TS1005: ']' expected

后端 未结 4 1376
我在风中等你
我在风中等你 2020-12-06 18:45

I am getting the following error when executing the command firebase deploy --only function in my Ionic 3 project. This solution is not working for me.

相关标签:
4条回答
  • 2020-12-06 18:50

    Judging from the github issue that you linked and the error message itself, the error seems to be due to the new readonly tuples feature. It was introduced in typescript@3.4.0 so, in theory, any typescript version higher than that should work.

    In fact, firebase-functions@3.2.0 uses typescript@3.5.2 so I recommend you use the same or higher.


    That being said, I see that you have already used typescript@3.5.3 but the error still popped up.

    Version details:

    "angularfire2": "^5.2.1",
    "firebase": "^6.3.1",
    "firebase-admin": "^8.2.0",
    "firebase-functions": "3.2.0",
    "typescript": "^3.5.3"
    

    It may be because of a different (older) typescript version being used by some other package internally. Please check your package-lock.json (or yarn.lock) to confirm.

    If that's not the case, then my next best guess is that ionic-app-scripts is using older typescript internally.

    0 讨论(0)
  • 2020-12-06 18:51

    Check if any space got added into starting of this file. I had the same issue and after removing the space in the top of the file it was working.

    0 讨论(0)
  • 2020-12-06 19:09

    In my case I just removed stub type from my packege.json and it started working for me updating just everything was not working, because this old shit is not compatable with the newer version of firebase well you didnt mentioned in your question that you do have this in your dependencies but I am 100% sure the problem is coming from here, because I just spent a whole night because of this:

    "dependencies": {
       "@types/firebase": "^3.2.1",  <<====== this is shit man
       "@types/fs-extra": "^8.0.1",
       "@types/mongoose": "^5.5.43",
       "@types/request": "^2.48.4",
       "actions-on-google": "^2.12.0",
       "bcrypt-inzi": "^1.0.7",
       "body-parser": "^1.18.3",
       "dialogflow-fulfillment": "^0.6.1",
       "express": "^4.17.1",
       "firebase-admin": "^8.6.0",
       "firebase-functions": "^3.3.0",
       "fs-extra": "^8.1.0",
       "mongoose": "^5.8.9",
       "request": "^2.88.0"
     },
    

    have you noticed this warning when running npm i

    npm WARN deprecated @types/firebase@3.2.1: This is a stub types definition for Firebase API (https://www.firebase.com/docs/javascript/firebase). Firebase API provides its own type definitions, so you don't need @types/firebase installed!

    since firebase functions have its own typing file it is not required at all now

    0 讨论(0)
  • 2020-12-06 19:13

    npm install -g typescript@3.5.3 worked for me. I assume higher versions would work as well. It is important to update the global typescript version as my local typescript version update didn't work

    0 讨论(0)
提交回复
热议问题