grpc-node
grpc-node copied to clipboard
grpc stream typescript type of error in `call.on('error'` is Error instead of grpc.ServiceError
Problem description
The type of the error in
const call = client.RequestFooStream({});
call.on('error', (error) => {}
is Error. I assume it should be grpc.ServiceError which is defined as export type ServiceError = StatusObject & Error; inside your package.
Environment
- @grpc/grpc-js: 1.13.3
- Node v20
I don't think that would be entirely correct, because the streaming call types are subtypes of the built in stream classes. That means that there may be other error events than the ServiceError ones, so Error is the most generally correct type.