build: fix dashboard error (#5010)

* Fixes a TypeScript error in the dashboard functions.
This commit is contained in:
Paul Gschwendtner
2017-06-08 20:24:49 +02:00
committed by Andrew Seguin
parent a5b014f771
commit 22e14490d2
3 changed files with 8 additions and 5 deletions
@@ -9,7 +9,9 @@ const repoSlug = config().repoSlug;
export function verifyToken(token: string): boolean {
try {
const tokenPayload = verify(token, jwtSecret, {issuer: 'Travis CI, GmbH'});
// The returned value of the verify method can be either a string or a object. Reading
// properties without explicitly treating the result as `any` will lead to a TypeScript error.
const tokenPayload = verify(token, jwtSecret, {issuer: 'Travis CI, GmbH'}) as any;
if (tokenPayload.slug !== repoSlug) {
console.log(`JWT slugs are not matching. Expected ${repoSlug}`);
+3 -3
View File
@@ -3,12 +3,12 @@
"version": "0.0.1",
"main": "index.js",
"dependencies": {
"@types/jsonwebtoken": "^7.2.0",
"@types/jsonwebtoken": "^7.2.1",
"firebase-admin": "~4.2.1",
"firebase-functions": "^0.5.7",
"jsonwebtoken": "^7.4.1",
"request": "^2.81.0",
"ts-node": "^3.0.4",
"typescript": "^2.3.3"
"ts-node": "^3.0.6",
"typescript": "^2.3.4"
}
}
+2 -1
View File
@@ -8,7 +8,8 @@
"sourceMap": true,
"target": "es5",
"baseUrl": "",
"outDir": "../../../dist/dashboard-functions/"
"outDir": "../../../dist/dashboard-functions/",
"types": ["jsonwebtoken"]
},
"files": [
"./functions.ts"