Skip to content

grpc-js & gpc-native-core: Types mismatch for ServerWritableStream #1581

@badsyntax

Description

@badsyntax

Problem description

I'm seeing a type difference in grpc-js and gpc-native-core.

export type ServerWriteableStream<RequestType> = ServerWritableStream<RequestType>;

export type ServerWritableStream<
RequestType,
ResponseType
> = ServerSurfaceCall &

ServerWritableStream requires one type argument within grpc-native-core and 2 within grpc-js.

Reproduction steps

I'm playing around with the typescript generator within #1474 which generates following service definition:

export interface ChatHandlers extends grpc.UntypedServiceImplementation {
  join(call: grpc.ServerWritableStream<_chat_package_ClientMessage__Output, _chat_package_ServerMessage>): void;
  send(call: grpc.ServerUnaryCall<_chat_package_ClientMessage__Output, _chat_package_ServerMessage>, callback: grpc.sendUnaryData<_chat_package_ServerMessage>): void;
}
Using this proto definition
syntax = "proto3";

package chat_package;

message ServerMessage {
  string user = 1;
  string text = 2;
}

message ClientMessage {
  string user = 1;
  string text = 2;
}

service Chat {
  rpc join(ClientMessage) returns (stream ServerMessage) {}
  rpc send(ClientMessage) returns (ServerMessage) {}
}

..which is incompatible with the types found in grpc-native-core (the grpc npm package)

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