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

I need to generate file interface IUser {} #246

Open
mjpcasey opened this issue Dec 26, 2023 · 3 comments
Open

I need to generate file interface IUser {} #246

mjpcasey opened this issue Dec 26, 2023 · 3 comments
Labels
question Further information is requested

Comments

@mjpcasey
Copy link

message User{ string userId = 1; string name = 2; string headImg = 3; }
I need to generate file interface IUser {}

@thesayyn
Copy link
Owner

thesayyn commented Mar 1, 2024

What do you mean you need to generate IUser?

@thesayyn thesayyn added the question Further information is requested label Mar 1, 2024
@plachta11b
Copy link

I would expect this to be generated:

interface IUser {
  userId: string;
  name: string;
  headImg: string;
}

It would be handy to have a typescript object with the type acquired from the generator after converting gRPC PROTO models with the ToObject method.

@thesayyn
Copy link
Owner

thesayyn commented Mar 1, 2024

This would make protoc-gen-ts generate more code, than it currently is. You can use typescript type inference for this.

Something like this would work;

type IUser = ReturnType<typeof User.prototype.toObject>

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

No branches or pull requests

3 participants