Argument of type 'Handler' is not assignable to parameter of type 'UntypedServiceImplementation' - grpc_tools_node_protoc_ts

Upgraded to the latest and started getting the error message above when using the addService call. Noticed that in your example you are ignoring the compilation issue with the ts-ignore directive, is this a known issue?

Asked Sep 29 '21 04:09
avatar yellowandy

6 Answer:

Do you mean this one?

Answered Dec 18 '20 at 01:48
avatar  of agreatfool

Seems not, could you share some sample codes or proto file? Also the versions you are using. Including the grpc_tools_node_protoc.

Answered Dec 18 '20 at 01:49
avatar  of agreatfool

Yes, it's a known issue. Let me have a look what I can do to solve | improve it.

Answered Dec 18 '20 at 02:08
avatar  of agreatfool

Thanks. Great to see this fixed. It looks like we now have Type parity across the popular tools:

  • grpc-proto-loader
  • ts-protoc-gen
  • grpctoolsnodeprotocts

I'll update my example in to show this latest change.

Answered Dec 29 '20 at 12:17
avatar  of badsyntax

I'm not sure this is fixed. After updating to 5.1.0, I started getting TS compilation errors due to this change. VS Code expects the following to be in my implementation:

class MyServerImpl implements IMyServiceServer {
    [name: string]: grpc.UntypedHandleCall; // <== This line is expected...

    // But if I have properties / methods that are not RPC-handling like...
    data: Foo = ...;
    someOtherFunction() {...}

I get the following compiler error: Property 'data' of type 'Foo' is not assignable to string index type 'HandleCall'.ts(2411)

Answered Jan 04 '21 at 07:17
avatar  of codedread