Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function newClient(pkg: string, service: string, URL: string): T {
const imp = require(`../../proto/${pkg}_grpc_pb`);
// As per https://github.com/agreatfool/grpc_tools_node_protoc_ts/blob/master/examples/src/grpcjs/client.ts
const cons = makeClientConstructor(imp[`${pkg}.${service}`], service);
// ugh
return new cons(URL, grpc.credentials.createInsecure()) as unknown as T
}