Skip to content

Commit 14c249b

Browse files
committed
yarn docgen devsite
1 parent 5527d33 commit 14c249b

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

docs-devsite/firestore_.firestoredataconverter.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ toFirestore(modelObject: PartialWithFieldValue<AppModelType>, options: SetOption
101101
Simple Example
102102

103103
```typescript
104-
const numberConverter: FirestoreDataConverter<number, {value: number}> = {
104+
const numberConverter = {
105105
toFirestore(value: WithFieldValue<number>) {
106106
return { value };
107107
},
@@ -152,19 +152,19 @@ interface PostDbModel {
152152
lut: Timestamp;
153153
}
154154
155-
// The `PostConverter` implements `FirestoreDataConverter<AppModelType, DbModelType>`
156-
// and specifies how the Firestore SDK can convert `Post` objects to `PostDbModel`
155+
// The `PostConverter` implements `FirestoreDataConverter` and specifies
156+
// how the Firestore SDK can convert `Post` objects to `PostDbModel`
157157
// objects and vice versa.
158158
class PostConverter implements FirestoreDataConverter<Post, PostDbModel> {
159-
toFirestore(post: WithFieldValue<Post>) {
159+
toFirestore(post: WithFieldValue<Post>): WithFieldValue<PostDbModel> {
160160
return {
161161
ttl: post.title,
162162
aut: this._autFromAuthor(post.author),
163163
lut: this._lutFromLastUpdatedMillis(post.lastUpdatedMillis)
164164
};
165165
}
166166
167-
fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions) {
167+
fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions): Post {
168168
const data = snapshot.data(options) as PostDbModel;
169169
const author = `${data.aut.firstName} ${data.aut.lastName}`;
170170
return new Post(data.ttl, author, data.lut.toMillis());
@@ -209,7 +209,7 @@ async function advancedDemo(db: Firestore): Promise<void> {
209209
});
210210
211211
// The TypeScript compiler will fail to compile if the `data` argument to
212-
// `setDoc()` is _not_ be compatible with `WithFieldValue<Post>`. This
212+
// `setDoc()` is _not_ compatible with `WithFieldValue<Post>`. This
213213
// type checking prevents the caller from specifying objects with incorrect
214214
// properties or property values.
215215
// @ts-expect-error "Argument of type { ttl: string; } is not assignable
@@ -234,15 +234,15 @@ async function advancedDemo(db: Firestore): Promise<void> {
234234
// `PostDbModel`. Similar to `setDoc()`, since the `data` argument is typed
235235
// as `WithFieldValue<PostDbModel>` rather than just `PostDbModel`, this
236236
// allows properties of the `data` argument to also be those special
237-
// Firestore values, like as `arrayRemove()`, `deleteField()`, and
237+
// Firestore values, like `arrayRemove()`, `deleteField()`, and
238238
// `serverTimestamp()`.
239239
await updateDoc(documentRef, {
240240
'aut.firstName': 'NewFirstName',
241241
lut: serverTimestamp()
242242
});
243243
244244
// The TypeScript compiler will fail to compile if the `data` argument to
245-
// `updateDoc()` is _not_ be compatible with `WithFieldValue<PostDbModel>`.
245+
// `updateDoc()` is _not_ compatible with `WithFieldValue<PostDbModel>`.
246246
// This type checking prevents the caller from specifying objects with
247247
// incorrect properties or property values.
248248
// @ts-expect-error "Argument of type { title: string; } is not assignable

docs-devsite/firestore_lite.firestoredataconverter.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ toFirestore(modelObject: PartialWithFieldValue<AppModelType>, options: SetOption
100100
Simple Example
101101

102102
```typescript
103-
const numberConverter: FirestoreDataConverter<number, {value: number}> = {
103+
const numberConverter = {
104104
toFirestore(value: WithFieldValue<number>) {
105105
return { value };
106106
},
@@ -151,19 +151,19 @@ interface PostDbModel {
151151
lut: Timestamp;
152152
}
153153
154-
// The `PostConverter` implements `FirestoreDataConverter<AppModelType, DbModelType>`
155-
// and specifies how the Firestore SDK can convert `Post` objects to `PostDbModel`
154+
// The `PostConverter` implements `FirestoreDataConverter` and specifies
155+
// how the Firestore SDK can convert `Post` objects to `PostDbModel`
156156
// objects and vice versa.
157157
class PostConverter implements FirestoreDataConverter<Post, PostDbModel> {
158-
toFirestore(post: WithFieldValue<Post>) {
158+
toFirestore(post: WithFieldValue<Post>): WithFieldValue<PostDbModel> {
159159
return {
160160
ttl: post.title,
161161
aut: this._autFromAuthor(post.author),
162162
lut: this._lutFromLastUpdatedMillis(post.lastUpdatedMillis)
163163
};
164164
}
165165
166-
fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions) {
166+
fromFirestore(snapshot: QueryDocumentSnapshot, options: SnapshotOptions): Post {
167167
const data = snapshot.data(options) as PostDbModel;
168168
const author = `${data.aut.firstName} ${data.aut.lastName}`;
169169
return new Post(data.ttl, author, data.lut.toMillis());
@@ -208,7 +208,7 @@ async function advancedDemo(db: Firestore): Promise<void> {
208208
});
209209
210210
// The TypeScript compiler will fail to compile if the `data` argument to
211-
// `setDoc()` is _not_ be compatible with `WithFieldValue<Post>`. This
211+
// `setDoc()` is _not_ compatible with `WithFieldValue<Post>`. This
212212
// type checking prevents the caller from specifying objects with incorrect
213213
// properties or property values.
214214
// @ts-expect-error "Argument of type { ttl: string; } is not assignable
@@ -233,15 +233,15 @@ async function advancedDemo(db: Firestore): Promise<void> {
233233
// `PostDbModel`. Similar to `setDoc()`, since the `data` argument is typed
234234
// as `WithFieldValue<PostDbModel>` rather than just `PostDbModel`, this
235235
// allows properties of the `data` argument to also be those special
236-
// Firestore values, like as `arrayRemove()`, `deleteField()`, and
236+
// Firestore values, like `arrayRemove()`, `deleteField()`, and
237237
// `serverTimestamp()`.
238238
await updateDoc(documentRef, {
239239
'aut.firstName': 'NewFirstName',
240240
lut: serverTimestamp()
241241
});
242242
243243
// The TypeScript compiler will fail to compile if the `data` argument to
244-
// `updateDoc()` is _not_ be compatible with `WithFieldValue<PostDbModel>`.
244+
// `updateDoc()` is _not_ compatible with `WithFieldValue<PostDbModel>`.
245245
// This type checking prevents the caller from specifying objects with
246246
// incorrect properties or property values.
247247
// @ts-expect-error "Argument of type { title: string; } is not assignable

0 commit comments

Comments
 (0)