Please read the k6 gRPC documentation which covers this example and breaks it down.
It uses grpcbin as the endpoint, which is a great resource for practicing gRPC scripting with k6 and debugging any problems.
The k6 gRPC library k6/net/grpc
didn't seem to be included in the @types/k6
so I've created my own based on the documentation.
If you have any issues see the API docs
More information about gRPC can be found on their website.
To run the script:
npm run go dist/grpc-example.px.js