-
Notifications
You must be signed in to change notification settings - Fork 24
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
Feature Request: Export All TypeScript Definitions as Top-Level Named Exports #1510
Comments
@alexander-fenster, what do you think? |
I agree that it's not easy to access the nested types. Exporting leaf level message types is a little bit harder than it seems. Problems that we'll need to solve with this approach:
From the implementation point of view, the main design principle of the generator is that it does not know anything about the target language (it does not know that it generates TypeScript), so the right way to implement this feature would be:
Let's think if we can actually make it work. In the meantime, @BenJackGill I can suggest you could try using namespace aliases as a workaround: import {protos} from '@google-cloud/resource-manager';
import v3 = protos.google.cloud.resourcemanager.v3;
const project: v3.IProject = {...}; Does it make it easier to use for you? |
It does make the code look cleaner but I think many people (myself included) usually try something like Using namespace aliases looks a little nicer but it doesn't really solve the problem because I still need to know the definitions live at Although I appreciate it might not be easy to fix because of the problems you raised. |
Yep, this is understood, we'll see what we can do! |
Is your feature request related to a problem? Please describe.
The
@google-cloud/resource-manager
package currently requires users to access its interfaces through deeply nested namespaces (e.g.,ResourceManager.protos.google.cloud.resourcemanager.v3.IProject
). This can be cumbersome and counterintuitive, particularly in TypeScript environments.The current subpar solution for accessing the TypeScript interfaces looks like this:
Describe the solution you'd like
I propose that all interfaces within the
@google-cloud/resource-manager
package (and also other packages if they have the same problem!) be exported as top-level named exports. This change would allow for more straightforward and cleaner import statements, enhancing the developer experience when working with TypeScript.Benefits:
With this change we could easily import TypeScript interfaces like so:
The text was updated successfully, but these errors were encountered: