How to Import FieldValue from firebase-admin using Typescript?

Viewed 2987

Is it possible to import FieldValue from firebase-admin npm using this style?

import { FieldValue } from 'firebase-admin/firestore';

By default my visual studio Code imports in this way:

import {FieldValue} from '@google-cloud/firestore';

but in this way, I have to add a new package only to import FieldValue ...

Is there any way to import it from firebase-admin using Typescript?

1 Answers

If you import like this:

import { firestore } from 'firebase-admin'

You can find it like this:

firestore.FieldValue

as it's re-exported from @google-cloud/firstore as part of its exported admin.firestore namespace.

Related