Closed optimistiks closed 3 years ago
Imagine you have this (Renamed FieldValue to fv to avoid confusion below).
FieldValue
fv
function migrate({ firestore, FieldValue: fv }: MigrateOptions) {}
So in this case, if you do something like
const timestamp = fv.serverTimestamp()
Typescript will complain: Property serverTimestamp is a static member of type FieldValue.
Property serverTimestamp is a static member of type FieldValue
It's because fv is typed as instance of class FieldValue, not the class FieldValue itself.
class FieldValue
The solution would be to type it like this FieldValue: typeof FieldValue.
FieldValue: typeof FieldValue
I haven't checked, but it might be the case for FieldPath and Timestamp as well.
FieldPath
Timestamp
Excellent. Thanks! I don't use TypeScript in my day-to-day, so any feedback is appreciated.
This is published in fireway@1.0.2
fireway@1.0.2
Imagine you have this (Renamed
FieldValue
tofv
to avoid confusion below).So in this case, if you do something like
Typescript will complain:
Property serverTimestamp is a static member of type FieldValue
.It's because
fv
is typed as instance ofclass FieldValue
, not theclass FieldValue
itself.The solution would be to type it like this
FieldValue: typeof FieldValue
.I haven't checked, but it might be the case for
FieldPath
andTimestamp
as well.