googleapis / googleapis/google-cloud-node
Feature Request: Export All TypeScript Definitions as Top-Level Named Exports
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 712
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 99
Description
**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:
```TypeScript
import * as ResourceManager from "@google-cloud/resource-manager";
const project: ResourceManager.protos.google.cloud.resourcemanager.v3.IProject = {
name: 'my-project-name',
projectId: 'my-project-id',
};
```
**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:
- Improves code readability and ease of maintenance.
- Simplifies the import process, making it more intuitive for developers.
- Aligns with TypeScript best practices, encouraging more widespread and effective use of the package.
With this change we could easily import TypeScript interfaces like so:
```TypeScript
import { Project } from "@google-cloud/resource-manager";
const project: Project = {
name: 'my-project-name',
projectId: 'my-project-id',
};
```
Contributor guide
Assessment
This issue has not been assessed yet.