-
So I'm trying to upgrade my modules to ESM, which I've done by setting However I'm running into a few type issues. If I import Typescript will then complain that the two types are not compatible. import { storage } from 'firebase-admin'
import { Bucket } from '@google-cloud/storage'
const bucket: Bucket = storage().bucket()
How do I solve this "correctly"? I can solve the above import type { Storage } from 'firebase-admin/storage'
type Bucket = ReturnType<Storage['bucket']> but this quickly gets very complicated, as the next type I need to extract is Help would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
So a workaround is doing: import type { Bucket } from '@google-cloud/storage/build/cjs/src/bucket.d.ts' And then adding the "paths": {
"@google-cloud/storage/build/cjs/src/bucket.d.ts": ["./node_modules/@google-cloud/storage/build/cjs/src/bucket.d.ts"]
} This basically screams "fix me later". |
Beta Was this translation helpful? Give feedback.
So a workaround is doing:
And then adding the
bucket.d.ts
topaths
in tsconfig's `compilerOptions:This basically screams "fix me later".