I am simply trying to build a firebase function using typescript. Right now my file is as follows:
import { onRequest } from "firebase-functions/v2/https";
import * as logger from "firebase-functions/logger";
import * as admin from "firebase-admin";
admin.initializeApp();
// Start writing functions
// https://firebase.google.com/docs/functions/typescript
export const helloWorld = onRequest((request, response) => {
logger.info("Hello logs!", { structuredData: true });
response.send("Hello from Firebase!");
});
And here is my tsconfig:
{
"compilerOptions": {
"module": "commonjs",
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "lib",
"sourceMap": true,
"strict": true,
"target": "es2017"
},
"compileOnSave": true,
"include": [
"src"
]
}
and for added measure, package.json
{
"name": "functions",
"scripts": {
"build": "tsc",
"build:watch": "tsc --watch",
"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": "18"
},
"main": "lib/index.js",
"dependencies": {
"firebase-admin": "^12.1.0",
"firebase-functions": "^5.0.0"
},
"devDependencies": {
"typescript": "^4.9.0",
"firebase-functions-test": "^3.1.0"
},
"private": true
}
Now, the fun part. When i run
tsc index.ts
I get the following error message
../node_modules/gaxios/build/src/gaxios.d.ts:6:5 - error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
6 #private;
~~~~~~~~
../node_modules/google-auth-library/build/src/auth/awsclient.d.ts:84:5 - error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
84 #private;
~~~~~~~~
../node_modules/google-auth-library/build/src/util.d.ts:134:5 - error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
134 #private;
~~~~~~~~
../node_modules/gtoken/build/src/index.d.ts:38:5 - error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
38 #private;
~~~~~~~~
Found 4 errors in 4 files.
Errors Files
1 ../node_modules/gaxios/build/src/gaxios.d.ts:6
1 ../node_modules/google-auth-library/build/src/auth/awsclient.d.ts:84
1 ../node_modules/google-auth-library/build/src/util.d.ts:134
1 ../node_modules/gtoken/build/src/index.d.ts:38
I have NO idea what I am doing wrong. This has never been an issue before. This code is being run in an isolated folder, so there are no other dependencies it could be interfering with. Please, someone help.
Recognized by Google Cloud Collective
2