I've been working on coding a Google Cloud Function that involves using the URL standard along with URLSearchParams
. After discovering that they are included in the TypeScript DOM library, I made sure to add it to my tsconfig file under the lib
setting.
However, upon compiling and deploying the cloud function, I encountered a runtime error stating that URLSearchParams is not defined. What could I possibly be overlooking? My current setup uses TS 2.6.
Here is an excerpt from my configuration:
{
"compilerOptions": {
/* Basic Options */
"target": "es6",
"module": "commonjs",
"lib": ["es6", "es7", "esnext", "dom"],
"sourceMap": true,
"outDir": "build",
"removeComments": true,
/* Strict Type-Checking Options */
"strict": true,
/* Additional Checks */
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"plugins": [{ "name": "tslint-language-service" }],
"skipLibCheck": false
},
"include": ["src/**/*"],
"exclude": ["build"]
}
And here are the dependencies listed in my package.json file:
"dependencies": {
"circular-json": "^0.4.0",
"es6-promisify": "^5.0.0",
"firebase-admin": "^5.5.0",
"firebase-functions": "^0.7.3",
"invariant": "^2.2.2",
"joi": "12",
"lodash": "^4.17.4",
"node-fetch": "^2.0.0-alpha.9"
},
"devDependencies": {
"@types/circular-json": "^0.4.0",
"@types/invariant": "^2.2.29",
"@types/joi": "^13.0.0",
"@types/lodash": "^4.14.85",
"@types/node": "^8.0.52",
"@types/node-fetch": "^1.6.7",
"cpy-cli": "^1.0.1",
"del-cli": "^1.1.0",
"firebase-tools": "^3.15.1",
"tslint": "^5.8.0",
"tslint-config-prettier": "^1.6.0",
"tslint-language-service": "^0.9.6",
"typescript": "2.6"
}