You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Uses const types for `requestStream` and `responseStream`, either `true`
or `false` types instead of generic `boolean` TS types allowing advanced
call type inference from the service definition.
Higher abstraction framework libraries, such as
https://github.com/malijs/mali could leverage advanced type inference to
hint/check specific type handlers if this information would be part of
the type rpc service type definition.
At this point, the only way to determine thy type of RPC is using
I{{{serviceName}}}Server interface, which must be linked manually to
I{{{serviceName}}}Service methods. For registring handlers at runtime,
only e.g. `GreeterService` and corresponding implementation is required,
manually adding `IGreeterServer` is possible, but troublesome. This
would not be required if rpc type could be inferred using the const
booleans to define the type.
This change does is not a breaking change and the const boolean types
are working correctly since the oldest available version on TS
playground 2.4.1. See playground link in the trailers.
There are no obvoius disadvantages to using const booleans and change
could potentially give node grpc frameworks more power for sophisticated
type inference.
See: https://www.typescriptlang.org/play/?ts=2.4.1#code/MYewdgzgLgBAhsYBTADlAKgJwK5JgXhgAoA3OAGwC4YockBKAgPhjPIChRJYFk0AxChDyFSFagDMhDZqwrt2vVBjpEp5YfUWJlgjUjXStStFlxFauYzoHSLdekA
0 commit comments