File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
packages/firestore/src/remote Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -160,19 +160,20 @@ export class JsonProtoSerializer {
160
160
}
161
161
162
162
/**
163
- * Returns a value for a number (or undefined ) that's appropriate to put into
163
+ * Returns a value for a number (or null ) that's appropriate to put into
164
164
* a google.protobuf.Int32Value proto.
165
165
* DO NOT USE THIS FOR ANYTHING ELSE.
166
166
* This method cheats. It's typed as returning "number" because that's what
167
167
* our generated proto interfaces say Int32Value must be. But GRPC actually
168
168
* expects a { value: <number> } struct.
169
169
*/
170
- private toInt32Value ( val : number | null ) : number | undefined {
171
- if ( ! typeUtils . isNullOrUndefined ( val ) ) {
170
+ private toInt32Value ( val : number | null ) : number | null {
171
+ if ( this . options . useProto3Json || typeUtils . isNullOrUndefined ( val ) ) {
172
+ return val ;
173
+ } else {
174
+ // ProtobufJS requires that we wrap Int32Values.
172
175
// eslint-disable-next-line @typescript-eslint/no-explicit-any, We need to match generated Proto types.
173
176
return { value : val } as any ;
174
- } else {
175
- return undefined ;
176
177
}
177
178
}
178
179
@@ -1043,7 +1044,7 @@ export class JsonProtoSerializer {
1043
1044
}
1044
1045
1045
1046
const limit = this . toInt32Value ( query . limit ) ;
1046
- if ( limit !== undefined ) {
1047
+ if ( limit !== null ) {
1047
1048
result . structuredQuery ! . limit = limit ;
1048
1049
}
1049
1050
You can’t perform that action at this time.
0 commit comments