'Cannot Type cast using Firebase Admin & Google Cloud Functions
I need to type cast some variables, but for some reason I am finding the types impossible to import via firebase-admin.
Here is an over-simplified example.
import * as functions from 'firebase-functions'
import * as admin from 'firebase-admin'
import { Bucket } from 'where??'
admin.initializeApp()
exports.myFunc = functions.storage.object().onFinalize(async myFile => {
const bucket = admin.storage().bucket() // this works
const bucket: Bucket = admin.storage().bucket() // but I want to do this
})
Solution 1:[1]
I was required to install and import the following package:
import { Bucket } from @google-cloud/storage
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ryan Prentiss |
