File tree 2 files changed +6
-4
lines changed
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ export class GeoPoint implements Serializable {
50
50
* `${data.google.longitude}`);
51
51
* });
52
52
*/
53
- constructor ( latitude , longitude ) {
53
+ constructor ( latitude : number , longitude : number ) {
54
54
validate . isNumber ( 'latitude' , latitude , - 90 , 90 ) ;
55
55
validate . isNumber ( 'longitude' , longitude , - 180 , 180 ) ;
56
56
@@ -65,7 +65,7 @@ export class GeoPoint implements Serializable {
65
65
* @name GeoPoint#latitude
66
66
* @readonly
67
67
*/
68
- get latitude ( ) {
68
+ get latitude ( ) : number {
69
69
return this . _latitude ;
70
70
}
71
71
@@ -76,7 +76,7 @@ export class GeoPoint implements Serializable {
76
76
* @name GeoPoint#longitude
77
77
* @readonly
78
78
*/
79
- get longitude ( ) {
79
+ get longitude ( ) : number {
80
80
return this . _longitude ;
81
81
}
82
82
@@ -121,6 +121,6 @@ export class GeoPoint implements Serializable {
121
121
* @private
122
122
*/
123
123
static fromProto ( proto : google . type . ILatLng ) : GeoPoint {
124
- return new GeoPoint ( proto . latitude , proto . longitude ) ;
124
+ return new GeoPoint ( proto . latitude || 0 , proto . longitude || 0 ) ;
125
125
}
126
126
}
Original file line number Diff line number Diff line change @@ -170,11 +170,13 @@ describe('DocumentReference class', function() {
170
170
objectValue : { foo : 'bar' , '😀' : '😜' } ,
171
171
emptyObject : { } ,
172
172
dateValue : new Firestore . Timestamp ( 479978400 , 123000000 ) ,
173
+ zeroDateValue : new Firestore . Timestamp ( 0 , 0 ) ,
173
174
pathValue : firestore . doc ( 'col1/ref1' ) ,
174
175
arrayValue : [ 'foo' , 42 , 'bar' ] ,
175
176
emptyArray : [ ] ,
176
177
nilValue : null ,
177
178
geoPointValue : new Firestore . GeoPoint ( 50.1430847 , - 122.947778 ) ,
179
+ zeroGeoPointValue : new Firestore . GeoPoint ( 0 , 0 ) ,
178
180
bytesValue : Buffer . from ( [ 0x01 , 0x02 ] ) ,
179
181
} ;
180
182
let ref = randomCol . doc ( 'doc' ) ;
You can’t perform that action at this time.
0 commit comments