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
})
I was required to install and import the following package:
import { Bucket } from @google-cloud/storage
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.