@@ -51,7 +51,7 @@ import { AbstractUserDataWriter } from './user_data_writer';
51
51
* Simple Example
52
52
*
53
53
* ```typescript
54
- * const numberConverter: FirestoreDataConverter<number, {value: number}> = {
54
+ * const numberConverter = {
55
55
* toFirestore(value: WithFieldValue<number>) {
56
56
* return { value };
57
57
* },
@@ -102,19 +102,19 @@ import { AbstractUserDataWriter } from './user_data_writer';
102
102
* lut: Timestamp;
103
103
* }
104
104
*
105
- * // The `PostConverter` implements `FirestoreDataConverter<AppModelType, DbModelType>`
106
- * // and specifies how the Firestore SDK can convert `Post` objects to `PostDbModel`
105
+ * // The `PostConverter` implements `FirestoreDataConverter` and specifies
106
+ * // how the Firestore SDK can convert `Post` objects to `PostDbModel`
107
107
* // objects and vice versa.
108
108
* class PostConverter implements FirestoreDataConverter<Post, PostDbModel> {
109
- * toFirestore(post: WithFieldValue<Post>) {
109
+ * toFirestore(post: WithFieldValue<Post>): WithFieldValue<PostDbModel> { {
110
110
* return {
111
111
* ttl: post.title,
112
112
* aut: this._autFromAuthor(post.author),
113
113
* lut: this._lutFromLastUpdatedMillis(post.lastUpdatedMillis)
114
114
* };
115
115
* }
116
116
*
117
- * fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions) {
117
+ * fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions): Post {
118
118
* const data = snapshot.data(options) as PostDbModel;
119
119
* const author = `${data.aut.firstName} ${data.aut.lastName}`;
120
120
* return new Post(data.ttl, author, data.lut.toMillis());
@@ -159,7 +159,7 @@ import { AbstractUserDataWriter } from './user_data_writer';
159
159
* });
160
160
*
161
161
* // The TypeScript compiler will fail to compile if the `data` argument to
162
- * // `setDoc()` is _not_ be compatible with `WithFieldValue<Post>`. This
162
+ * // `setDoc()` is _not_ compatible with `WithFieldValue<Post>`. This
163
163
* // type checking prevents the caller from specifying objects with incorrect
164
164
* // properties or property values.
165
165
* // @ts -expect-error "Argument of type { ttl: string; } is not assignable
@@ -184,15 +184,15 @@ import { AbstractUserDataWriter } from './user_data_writer';
184
184
* // `PostDbModel`. Similar to `setDoc()`, since the `data` argument is typed
185
185
* // as `WithFieldValue<PostDbModel>` rather than just `PostDbModel`, this
186
186
* // allows properties of the `data` argument to also be those special
187
- * // Firestore values, like as `arrayRemove()`, `deleteField()`, and
187
+ * // Firestore values, like `arrayRemove()`, `deleteField()`, and
188
188
* // `serverTimestamp()`.
189
189
* await updateDoc(documentRef, {
190
190
* 'aut.firstName': 'NewFirstName',
191
191
* lut: serverTimestamp()
192
192
* });
193
193
*
194
194
* // The TypeScript compiler will fail to compile if the `data` argument to
195
- * // `updateDoc()` is _not_ be compatible with `WithFieldValue<PostDbModel>`.
195
+ * // `updateDoc()` is _not_ compatible with `WithFieldValue<PostDbModel>`.
196
196
* // This type checking prevents the caller from specifying objects with
197
197
* // incorrect properties or property values.
198
198
* // @ts -expect-error "Argument of type { title: string; } is not assignable
0 commit comments