unfortunately this is not flexible enough to handle field value as field value output is different from input

especially server timestamp, also apply to number and array where they can accept field value

we still need better wrapper

const converter = {

toFirestore: (data: { createdAt: Firestore.FieldValue }) => data, // server time stamp

fromFirestore: (snap: FirebaseFirestore.QueryDocumentSnapshot) =>

snap.data() as {

createdAt: Firestore.Timestamp // timestamp object

},

}

firestore().collection('users').withConverter(converter) // type error

--

--

Typescript Zombie. Youtube Pikachu On Acid. (Unrelated to programming but by watching it you become a good developer overnight)

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Acid Coder

Typescript Zombie. Youtube Pikachu On Acid. (Unrelated to programming but by watching it you become a good developer overnight)