Ryan Prentiss
Ryan Prentiss

Reputation: 1642

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
})

Upvotes: 0

Views: 110

Answers (1)

Ryan Prentiss
Ryan Prentiss

Reputation: 1642

I was required to install and import the following package:

import { Bucket } from @google-cloud/storage

Upvotes: 1

Related Questions