Skip to content

Commit 65ba82f

Browse files
authored
chore: Clean up dead code and linter errors (googleapis#1166)
1 parent 4c1e453 commit 65ba82f

7 files changed

+9
-2772
lines changed

src/agent/firebase-controller.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import * as crypto from 'crypto';
2525

2626
import * as firebase from 'firebase-admin';
2727
import * as gcpMetadata from 'gcp-metadata';
28+
import {DataSnapshot} from 'firebase-admin/database';
2829

2930
import * as util from 'util';
3031
const debuglog = util.debuglog('cdbg.firebase');
@@ -37,7 +38,11 @@ const FIREBASE_APP_NAME = 'cdbg';
3738
* @param promise
3839
* @returns Promise wrapped in a timeout.
3940
*/
40-
const withTimeout = (ms: number, promise: Promise<any>) => {
41+
const withTimeout = (
42+
ms: number,
43+
promise: Promise<DataSnapshot>
44+
): Promise<unknown> => {
45+
// Note that the type above is constrained to make the linter happy.
4146
const timeout = new Promise((_, reject) =>
4247
setTimeout(() => reject(`Timed out after ${ms} ms.`), ms)
4348
);
@@ -126,7 +131,7 @@ export class FirebaseController implements Controller {
126131
db.ref('cdbg/schema_version').get()
127132
);
128133
if (version_snapshot) {
129-
const version = version_snapshot.val();
134+
const version = (version_snapshot as DataSnapshot).val();
130135
debuglog(
131136
`Firebase app initialized. Connected to ${databaseUrl}` +
132137
` with schema version ${version}`

0 commit comments

Comments
 (0)