Skip to content

Commit 65dc815

Browse files
committed
Doc updates to address feedback.
1 parent 3b14d04 commit 65dc815

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

packages/firestore/src/api/snapshot.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import { SnapshotListenOptions } from './reference_impl';
5353
* Simple Example
5454
*
5555
* ```typescript
56-
* const numberConverter: FirestoreDataConverter<number, {value: number}> = {
56+
* const numberConverter = {
5757
* toFirestore(value: WithFieldValue<number>) {
5858
* return { value };
5959
* },
@@ -104,19 +104,19 @@ import { SnapshotListenOptions } from './reference_impl';
104104
* lut: Timestamp;
105105
* }
106106
*
107-
* // The `PostConverter` implements `FirestoreDataConverter<AppModelType, DbModelType>`
108-
* // and specifies how the Firestore SDK can convert `Post` objects to `PostDbModel`
107+
* // The `PostConverter` implements `FirestoreDataConverter` and specifies
108+
* // how the Firestore SDK can convert `Post` objects to `PostDbModel`
109109
* // objects and vice versa.
110110
* class PostConverter implements FirestoreDataConverter<Post, PostDbModel> {
111-
* toFirestore(post: WithFieldValue<Post>) {
111+
* toFirestore(post: WithFieldValue<Post>): WithFieldValue<PostDbModel> {
112112
* return {
113113
* ttl: post.title,
114114
* aut: this._autFromAuthor(post.author),
115115
* lut: this._lutFromLastUpdatedMillis(post.lastUpdatedMillis)
116116
* };
117117
* }
118118
*
119-
* fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions) {
119+
* fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions): Post {
120120
* const data = snapshot.data(options) as PostDbModel;
121121
* const author = `${data.aut.firstName} ${data.aut.lastName}`;
122122
* return new Post(data.ttl, author, data.lut.toMillis());
@@ -161,7 +161,7 @@ import { SnapshotListenOptions } from './reference_impl';
161161
* });
162162
*
163163
* // The TypeScript compiler will fail to compile if the `data` argument to
164-
* // `setDoc()` is _not_ be compatible with `WithFieldValue<Post>`. This
164+
* // `setDoc()` is _not_ compatible with `WithFieldValue<Post>`. This
165165
* // type checking prevents the caller from specifying objects with incorrect
166166
* // properties or property values.
167167
* // @ts-expect-error "Argument of type { ttl: string; } is not assignable
@@ -186,15 +186,15 @@ import { SnapshotListenOptions } from './reference_impl';
186186
* // `PostDbModel`. Similar to `setDoc()`, since the `data` argument is typed
187187
* // as `WithFieldValue<PostDbModel>` rather than just `PostDbModel`, this
188188
* // allows properties of the `data` argument to also be those special
189-
* // Firestore values, like as `arrayRemove()`, `deleteField()`, and
189+
* // Firestore values, like `arrayRemove()`, `deleteField()`, and
190190
* // `serverTimestamp()`.
191191
* await updateDoc(documentRef, {
192192
* 'aut.firstName': 'NewFirstName',
193193
* lut: serverTimestamp()
194194
* });
195195
*
196196
* // The TypeScript compiler will fail to compile if the `data` argument to
197-
* // `updateDoc()` is _not_ be compatible with `WithFieldValue<PostDbModel>`.
197+
* // `updateDoc()` is _not_ compatible with `WithFieldValue<PostDbModel>`.
198198
* // This type checking prevents the caller from specifying objects with
199199
* // incorrect properties or property values.
200200
* // @ts-expect-error "Argument of type { title: string; } is not assignable

packages/firestore/src/lite-api/snapshot.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import { AbstractUserDataWriter } from './user_data_writer';
5151
* Simple Example
5252
*
5353
* ```typescript
54-
* const numberConverter: FirestoreDataConverter<number, {value: number}> = {
54+
* const numberConverter = {
5555
* toFirestore(value: WithFieldValue<number>) {
5656
* return { value };
5757
* },
@@ -102,19 +102,19 @@ import { AbstractUserDataWriter } from './user_data_writer';
102102
* lut: Timestamp;
103103
* }
104104
*
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`
107107
* // objects and vice versa.
108108
* class PostConverter implements FirestoreDataConverter<Post, PostDbModel> {
109-
* toFirestore(post: WithFieldValue<Post>) {
109+
* toFirestore(post: WithFieldValue<Post>): WithFieldValue<PostDbModel> { {
110110
* return {
111111
* ttl: post.title,
112112
* aut: this._autFromAuthor(post.author),
113113
* lut: this._lutFromLastUpdatedMillis(post.lastUpdatedMillis)
114114
* };
115115
* }
116116
*
117-
* fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions) {
117+
* fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions): Post {
118118
* const data = snapshot.data(options) as PostDbModel;
119119
* const author = `${data.aut.firstName} ${data.aut.lastName}`;
120120
* return new Post(data.ttl, author, data.lut.toMillis());
@@ -159,7 +159,7 @@ import { AbstractUserDataWriter } from './user_data_writer';
159159
* });
160160
*
161161
* // 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
163163
* // type checking prevents the caller from specifying objects with incorrect
164164
* // properties or property values.
165165
* // @ts-expect-error "Argument of type { ttl: string; } is not assignable
@@ -184,15 +184,15 @@ import { AbstractUserDataWriter } from './user_data_writer';
184184
* // `PostDbModel`. Similar to `setDoc()`, since the `data` argument is typed
185185
* // as `WithFieldValue<PostDbModel>` rather than just `PostDbModel`, this
186186
* // 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
188188
* // `serverTimestamp()`.
189189
* await updateDoc(documentRef, {
190190
* 'aut.firstName': 'NewFirstName',
191191
* lut: serverTimestamp()
192192
* });
193193
*
194194
* // 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>`.
196196
* // This type checking prevents the caller from specifying objects with
197197
* // incorrect properties or property values.
198198
* // @ts-expect-error "Argument of type { title: string; } is not assignable

0 commit comments

Comments
 (0)