Skip to content

Commit 7d44557

Browse files
weakishleeyeh
authored andcommitted
feat(ts): more accurate GeoPoint constructor typing (#576)
related ticket: 21549
1 parent f760acd commit 7d44557

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

storage.d.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,14 @@ export class GeoPoint extends BaseObject {
209209
latitude: number;
210210
longitude: number;
211211

212-
constructor(arg1?: any, arg2?: any);
212+
constructor(other: GeoPoint);
213+
// -90.0 <= latitude <= 90.0, and -180.0 <= longitude <= 180.0,
214+
// but TypeScript does not support refinement types yet (Microsoft/TypeScript#7599),
215+
// so we just specify number here.
216+
constructor(lat: number, lon: number);
217+
constructor(latLon: [number, number]);
218+
constructor(latLonObj: { latitude: number; longitude: number });
219+
constructor();
213220

214221
static current(options?: AuthOptions): Promise<GeoPoint>;
215222
radiansTo(point: GeoPoint): number;

0 commit comments

Comments
 (0)