-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not compatible with protobufjs 6.7.x #7
Comments
Could you share your yarn lock file? Or if not used, the package json? |
yarn.lock |
Quick fix: revert back protobufjs to ~6.6.5. |
You can update rxjs-grpc to 0.1.2, it has set the correct protobufjs version. |
thank you, it works! atom and vs code still show the error |
It should work well in VS code, I am using it everyday. Can you share a bit more? At least the ts file and on which line you have the error. |
sample.proto
server.ts import { Observable } from 'rxjs';
import { serverBuilder } from 'rxjs-grpc';
import { sample } from './grpc-namespaces';
async function main() {
type ServerBuilder = sample.ServerBuilder;
const server = serverBuilder<ServerBuilder>('sample.proto', 'sample');
server.addGreeter({
sayHello(request) {
return Observable.of({
message: 'Hello ' + request.name
});
},
sayMultiHello(request) {
return Observable.timer(100, 500)
.mapTo({ message: `Hello ${request.name}` })
.take(request.num_greetings);
}
});
server.start('0.0.0.0:50051');
}
main().catch(error => console.error(error)); client.ts import { clientFactory } from 'rxjs-grpc';
import { sample } from './grpc-namespaces';
async function main() {
type ClientFactory = sample.ClientFactory;
const Services = clientFactory<ClientFactory>('sample.proto', 'sample');
const services = new Services('localhost:50051');
const greeter = services.getGreeter();
await greeter.sayMultiHello({ name: 'world', num_greetings: 3 }).forEach(response => {
console.log(`Multi greeting: ${response.message}`);
});
await greeter.sayHello({ name: 'world' }).forEach(response => {
console.log(`Greeting: ${response.message}`);
});
}
main().catch(error => console.error(error)); |
It looks like the grpc-namespaces is still the one generated with the old version. |
you are right! i recreated the namespace-file and now everythink looks good |
Released in v0.2.0. |
the rxjs-grpc cli produce this line:
You will get the error
Property 'name' does not exist on type 'HelloRequest | { [k: string]: any; }'.
If you change the pipe-symbol
|
to an ampersand-symbol&
it should work.The text was updated successfully, but these errors were encountered: