Skip to content

Broken typescript exports after moving to @grpc/grpc-js #1600

@ikibalnyi

Description

@ikibalnyi

Hey,

After updating to @grpc/grpc-js all the exports got changed from export BookService

out->Print(template_vars, "var $name$Service = exports.$name$Service = {\n");
to export['com.book.BookService'].
out->Print(template_vars, "var $name$Service = exports['$full_name$'] = {\n");

What is the point of such change? Now it's not possible to generate proper typescript definitions for such exports.

// grpc
import { BookServiceClient } from "./proto/book_grpc_pb";
const client = new BookServiceClient("127.0.0.1:50051", grpc.credentials.createInsecure());

// changed to

// grpc-js
import * as bookGrpcPb from "./proto/book_grpc_pb";
// @ts-ignore
const BookServiceClient = grpc.makeClientConstructor(bookGrpcPb["com.book.BookService"], "BookService");

So now such export is not valid for Typescript and you have to write // @ts-ignore.
Why was removed export of the BookServiceClient? or at least BookService?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions