Closed JakeHedman closed 4 years ago
Thank you, @JakeHedman. To solve this issue I've made small adjustments to the timestamp typing.
Now the generated .ts
file will export a WardTimestamp
type that follows the official docs you linked above. The file will also export an isTimestamp
function, which is a type predicate for the aforementioned WardTimestamp
. So you'll be able to type-safely do something like if (isTimestamp(data.stamp)) console.log(data.stamp.toDate());
.
All this should be available as v 1.2.3.
The timestamp type is missing a few functions,
toDate
is the one I mainly care about. :)https://firebase.google.com/docs/reference/node/firebase.firestore.Timestamp.html#to-date