Closed puf closed 3 years ago
Don't merge yet, as I think I still need to move some tests - which should also improve coverage again.
But aside from that, the main code could do with a thorough review.
OK, I think that covers it for now. @samtstern : Can you review, mostly focusing on the signature changes of the API to ensure they're indeed non-breaking? See go/geofire-types 🔐 for reference of the changes.
Description
This PR makes the GeoFire API more type-safe by introducing three new types:
type geopoint = [number, number]
, replacingnumber[]
everywhere it represents a single geopoint.type geohash = string
, replacingstring
everywhere it represents a geohash value.type geohashRange = [geohash, geohash]
replacingstring[]
where it represents a tuple of two strings representing a geohash range to query.This change does not make any change to the actual underlying code, and the signatures are backwards compatible to any correctly working code on the previous API. The only difference after this change is that more errors will be caught at compile time (when TypeScript is converted to JavaScript), rather than by the extensive runtime checks that GeoFire performs on them.
For googlers: the full list of type changes can be found on go/geofire-types.