Skip to content

Commit 52bc217

Browse files
committed
Revised comments.
1 parent 019aa4d commit 52bc217

File tree

13 files changed

+27
-23
lines changed

13 files changed

+27
-23
lines changed

common/api-review/firestore.api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export class DocumentSnapshot<AppModelType = DocumentData, DbModelType extends D
178178
protected constructor();
179179
data(options?: SnapshotOptions): AppModelType | undefined;
180180
exists(): this is QueryDocumentSnapshot<AppModelType, DbModelType>;
181-
static fromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(db: Firestore, json: object, converter: FirestoreDataConverter<AppModelType, DbModelType>): DocumentSnapshot<AppModelType, DbModelType>;
181+
static fromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(db: Firestore, json: object, converter?: FirestoreDataConverter<AppModelType, DbModelType> | null): DocumentSnapshot<AppModelType, DbModelType>;
182182
get(fieldPath: string | FieldPath, options?: SnapshotOptions): any;
183183
get id(): string;
184184
readonly metadata: SnapshotMetadata;
@@ -655,7 +655,7 @@ export class QuerySnapshot<AppModelType = DocumentData, DbModelType extends Docu
655655
get docs(): Array<QueryDocumentSnapshot<AppModelType, DbModelType>>;
656656
get empty(): boolean;
657657
forEach(callback: (result: QueryDocumentSnapshot<AppModelType, DbModelType>) => void, thisArg?: unknown): void;
658-
static fromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(db: Firestore, json: object): QuerySnapshot<AppModelType, DbModelType> | null;
658+
static fromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(db: Firestore, json: object): QuerySnapshot<AppModelType, DbModelType>;
659659
readonly metadata: SnapshotMetadata;
660660
readonly query: Query<AppModelType, DbModelType>;
661661
get size(): number;

docs-devsite/firestore_.documentsnapshot.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ Builds a `DocumentSnapshot` instance from a JSON object created by [DocumentSnap
128128
<b>Signature:</b>
129129

130130
```typescript
131-
static fromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(db: Firestore, json: object, converter: FirestoreDataConverter<AppModelType, DbModelType>): DocumentSnapshot<AppModelType, DbModelType>;
131+
static fromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(db: Firestore, json: object, converter?: FirestoreDataConverter<AppModelType, DbModelType> | null): DocumentSnapshot<AppModelType, DbModelType>;
132132
```
133133

134134
#### Parameters
@@ -137,7 +137,7 @@ static fromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(d
137137
| --- | --- | --- |
138138
| db | [Firestore](./firestore_.firestore.md#firestore_class) | |
139139
| json | object | a JSON object represention of a <code>DocumentSnapshot</code> instance. |
140-
| converter | [FirestoreDataConverter](./firestore_.firestoredataconverter.md#firestoredataconverter_interface)<!-- -->&lt;AppModelType, DbModelType&gt; | Converts objects to and from Firestore. |
140+
| converter | [FirestoreDataConverter](./firestore_.firestoredataconverter.md#firestoredataconverter_interface)<!-- -->&lt;AppModelType, DbModelType&gt; \| null | Converts objects to and from Firestore. |
141141

142142
<b>Returns:</b>
143143

docs-devsite/firestore_.querysnapshot.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Builds a `QuerySnapshot` instance from a JSON object created by [QuerySnapshot.t
135135
<b>Signature:</b>
136136

137137
```typescript
138-
static fromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(db: Firestore, json: object): QuerySnapshot<AppModelType, DbModelType> | null;
138+
static fromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(db: Firestore, json: object): QuerySnapshot<AppModelType, DbModelType>;
139139
```
140140

141141
#### Parameters
@@ -147,7 +147,7 @@ static fromJSON<AppModelType, DbModelType extends DocumentData = DocumentData>(d
147147

148148
<b>Returns:</b>
149149

150-
[QuerySnapshot](./firestore_.querysnapshot.md#querysnapshot_class)<!-- -->&lt;AppModelType, DbModelType&gt; \| null
150+
[QuerySnapshot](./firestore_.querysnapshot.md#querysnapshot_class)<!-- -->&lt;AppModelType, DbModelType&gt;
151151

152152
an instance of [QuerySnapshot](./firestore_.querysnapshot.md#querysnapshot_class) if the JSON object could be parsed. Throws a [FirestoreError](./firestore_.firestoreerror.md#firestoreerror_class) if an error occurs.
153153

docs-devsite/firestore_.timestamp.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export declare class Timestamp
4040
| Method | Modifiers | Description |
4141
| --- | --- | --- |
4242
| [fromDate(date)](./firestore_.timestamp.md#timestampfromdate) | <code>static</code> | Creates a new timestamp from the given date. |
43-
| [fromJSON(json)](./firestore_.timestamp.md#timestampfromjson) | <code>static</code> | Builds a <code>Timestamp</code> instance from a JSON serialized version of <code>Bytes</code>. |
43+
| [fromJSON(json)](./firestore_.timestamp.md#timestampfromjson) | <code>static</code> | Builds a <code>Timestamp</code> instance from a JSON object created by [Timestamp.toJSON()](./firestore_.timestamp.md#timestamptojson)<!-- -->. |
4444
| [fromMillis(milliseconds)](./firestore_.timestamp.md#timestampfrommillis) | <code>static</code> | Creates a new timestamp from the given number of milliseconds. |
4545
| [isEqual(other)](./firestore_.timestamp.md#timestampisequal) | | Returns true if this <code>Timestamp</code> is equal to the provided one. |
4646
| [now()](./firestore_.timestamp.md#timestampnow) | <code>static</code> | Creates a new timestamp with the current date, with millisecond precision. |
@@ -113,7 +113,7 @@ A new `Timestamp` representing the same point in time as the given date.
113113

114114
## Timestamp.fromJSON()
115115

116-
Builds a `Timestamp` instance from a JSON serialized version of `Bytes`<!-- -->.
116+
Builds a `Timestamp` instance from a JSON object created by [Timestamp.toJSON()](./firestore_.timestamp.md#timestamptojson)<!-- -->.
117117

118118
<b>Signature:</b>
119119

docs-devsite/firestore_.vectorvalue.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static fromJSON(json: object): VectorValue;
4343

4444
| Parameter | Type | Description |
4545
| --- | --- | --- |
46-
| json | object | a JSON object represention of a <code>VectorValue</code> instance |
46+
| json | object | a JSON object represention of a <code>VectorValue</code> instance. |
4747

4848
<b>Returns:</b>
4949

docs-devsite/firestore_lite.timestamp.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export declare class Timestamp
4040
| Method | Modifiers | Description |
4141
| --- | --- | --- |
4242
| [fromDate(date)](./firestore_lite.timestamp.md#timestampfromdate) | <code>static</code> | Creates a new timestamp from the given date. |
43-
| [fromJSON(json)](./firestore_lite.timestamp.md#timestampfromjson) | <code>static</code> | Builds a <code>Timestamp</code> instance from a JSON serialized version of <code>Bytes</code>. |
43+
| [fromJSON(json)](./firestore_lite.timestamp.md#timestampfromjson) | <code>static</code> | Builds a <code>Timestamp</code> instance from a JSON object created by [Timestamp.toJSON()](./firestore_.timestamp.md#timestamptojson)<!-- -->. |
4444
| [fromMillis(milliseconds)](./firestore_lite.timestamp.md#timestampfrommillis) | <code>static</code> | Creates a new timestamp from the given number of milliseconds. |
4545
| [isEqual(other)](./firestore_lite.timestamp.md#timestampisequal) | | Returns true if this <code>Timestamp</code> is equal to the provided one. |
4646
| [now()](./firestore_lite.timestamp.md#timestampnow) | <code>static</code> | Creates a new timestamp with the current date, with millisecond precision. |
@@ -113,7 +113,7 @@ A new `Timestamp` representing the same point in time as the given date.
113113

114114
## Timestamp.fromJSON()
115115

116-
Builds a `Timestamp` instance from a JSON serialized version of `Bytes`<!-- -->.
116+
Builds a `Timestamp` instance from a JSON object created by [Timestamp.toJSON()](./firestore_.timestamp.md#timestamptojson)<!-- -->.
117117

118118
<b>Signature:</b>
119119

docs-devsite/firestore_lite.vectorvalue.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static fromJSON(json: object): VectorValue;
4343

4444
| Parameter | Type | Description |
4545
| --- | --- | --- |
46-
| json | object | a JSON object represention of a <code>VectorValue</code> instance |
46+
| json | object | a JSON object represention of a <code>VectorValue</code> instance. |
4747

4848
<b>Returns:</b>
4949

packages/firestore/src/api/snapshot.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ export class DocumentSnapshot<
586586
>(
587587
db: Firestore,
588588
json: object,
589-
converter: FirestoreDataConverter<AppModelType, DbModelType>
589+
converter: FirestoreDataConverter<AppModelType, DbModelType> | null = null
590590
): DocumentSnapshot<AppModelType, DbModelType> {
591591
if (validateJSON(json, DocumentSnapshot._jsonSchema)) {
592592
// Parse the bundle data.
@@ -865,10 +865,7 @@ export class QuerySnapshot<
865865
static fromJSON<
866866
AppModelType,
867867
DbModelType extends DocumentData = DocumentData
868-
>(
869-
db: Firestore,
870-
json: object
871-
): QuerySnapshot<AppModelType, DbModelType> | null {
868+
>(db: Firestore, json: object): QuerySnapshot<AppModelType, DbModelType> {
872869
if (validateJSON(json, QuerySnapshot._jsonSchema)) {
873870
// Parse the bundle data.
874871
const serializer = newSerializer(db._databaseId);

packages/firestore/src/core/firestore_client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ export function firestoreClientGetNamedQuery(
809809
);
810810
}
811811

812-
export function createBundleReader(
812+
function createBundleReader(
813813
data: ReadableStream<Uint8Array> | ArrayBuffer | string,
814814
serializer: JsonProtoSerializer
815815
): BundleReader {

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,9 @@ export class Timestamp {
184184
nanoseconds: property('number')
185185
};
186186

187-
/** Returns a JSON-serializable representation of this `Timestamp`. */
187+
/**
188+
* Returns a JSON-serializable representation of this `Timestamp`.
189+
*/
188190
toJSON(): { seconds: number; nanoseconds: number; type: string } {
189191
return {
190192
type: Timestamp._jsonSchemaVersion,
@@ -193,7 +195,9 @@ export class Timestamp {
193195
};
194196
}
195197

196-
/** Builds a `Timestamp` instance from a JSON serialized version of `Bytes`. */
198+
/**
199+
* Builds a `Timestamp` instance from a JSON object created by {@link Timestamp.toJSON}.
200+
*/
197201
static fromJSON(json: object): Timestamp {
198202
if (validateJSON(json, Timestamp._jsonSchema)) {
199203
return new Timestamp(json.seconds, json.nanoseconds);

0 commit comments

Comments
 (0)