-
-
Notifications
You must be signed in to change notification settings - Fork 756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix circular dependency between lng_lat_bounds.ts and lng_lat.ts #2169
Conversation
I think we can break API since we are about to release version 3. |
Improve it in what way and to what extend? It is a quite subjective goal that can easily spin into big discussions. |
The code in this proposal is very complex when the goal is to remove circular dependecies, IMHO.
I think it's a cleaner solution to this circular dependency. |
How much emphasis should be put into maintaining backward compatibility? Any official guidance? |
I would say that the main map API should be relatively stable, we shouldn't break things all the time, but since we are planning a major release we are allowed to break some things. This method is relatively internal and so I don't we should feel to bad for moving it a bit (it's not that it won't be possible after the upgrade, and typescript should help us here). |
replaced by #2188 |
Launch Checklist
src/geo/lng_lat_bounds.ts -> src/geo/lng_lat.ts -> src/geo/lng_lat_bounds.ts
Both are public API so cannot change any signature. The problem was in toBounds method of LngLat class.
Solution:
rename original lng_lat.ts to lng_lat_partial.ts, import type LngLatBounds only, so circular dependency is broken.
leave only stub of toBounds
make another file lng_lat.ts, and actually add the body of toBounds
In lng_lat_bounds.ts only import lng_lat_partial
Everywhere else, all references to LngLat class remain the same.
A minor clean up on two constants to avoid future entanglement to these two classes.
Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
Briefly describe the changes in this PR.
Link to related issues.