Skip to content
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

Export ApiLibraryKeys for use in client code #281

Closed
wants to merge 1 commit into from

Conversation

man-trackunit
Copy link

@man-trackunit man-trackunit commented Mar 26, 2024

This way clients won't have to make their own copy ApiLibrary keys. Not sure if there's a better name than ApiLibraryKeys.

Alternatively a client could extract the type with something like:

type FirstArg<F extends (...args: never) => unknown> = Parameters<F>[0];
type ApiLibrary = FirstArg<typeof useMapsLibrary>;

But I'd consider that a hack. Better to just export the type imho. 🙏

@usefulthink
Copy link
Collaborator

This is actually a fix for a shortcoming in the @types/google.maps package. I already raised that issue in their tracker (googlemaps/js-types#95) but haven't heard back so far. It could be that this will get solved for @types/google.maps and you can import it from there. I would much prefer it that way.

If we implement this in this library, I would prefer to export the entire map as well, but also would like to find a better name for it first (maybe GoogleMapsLibraryMap / GoogleMapsLibraryName? what do you think?)

@man-trackunit
Copy link
Author

Hmm. Don't have a good suggestion for naming but your reasoning makes sense. I'll close this PR and hope you get through to @types/google.maps thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants