Home > Net >  Upgrade typescript to 4.1 in Firebase Project
Upgrade typescript to 4.1 in Firebase Project

Time:10-11

I want to upgrade typescript to version 4.1, because it adds support to template literal types.

However, when I run npm i typescript in the functions directory, it doesn't get upgraded above "^3.9.10".

package.json :

{
  "name": "functions",
  "scripts": {
    "lint": "eslint \"src/**/*\"",
    "build": "tsc",
    "serve": "npm run build && firebase emulators:start --only functions",
    "shell": "npm run build && firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "12"
  },
  "main": "lib/index.js",
  "dependencies": {
    "@firecode/admin": "^0.8.2",
    "axios": "^0.21.4",
    "cors": "^2.8.5",
    "exegesis": "^3.0.1",
    "express": "^4.17.1",
    "firebase-admin": "^9.12.0",
    "firebase-functions": "^3.15.7"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^3.9.1",
    "@typescript-eslint/parser": "^3.8.0",
    "eslint": "^7.32.0",
    "eslint-plugin-import": "^2.22.0",
    "firebase-functions-test": "^0.2.0",
    "typescript": "^3.9.10"
  },
  "private": true
}

tsconfig.json :

{
  "compilerOptions": {
    "module": "commonjs",
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "outDir": "lib",
    "sourceMap": true,
    "strict": true,
    "target": "es2017"
  },
  "compileOnSave": true,
  "include": [
    "src"
  ]
}

Thanks !

CodePudding user response:

Try npm install -g typescript@latest. You can also use npm update instead of install, without the latest modifier.

  • Related