nodejs-assistant
nodejs-assistant copied to clipboard
WIP update deps & code to @grpc/grpc-js
- Tried changing grpc -> @grpc/grpc-js. First commit in PR is using older versions of the library
- Old grpc will not compile https://github.com/grpc/grpc-node/issues/1880
- Current 'npm run build' hits TypeScript error in conversation.ts
I tried bumping @grpc library versions but it doesn't change the error. I'm not familiar with TypeScript & didn't recognize how to resolve this error... but maybe it's obvious to a TS dev?
$ npm run build
> [email protected] build
> rm -rf lib && rollup -c rollup.config.ts
src/assistant.ts → lib/assistant.js, lib/assistant.mjs...
created lib/assistant.js, lib/assistant.mjs in 576ms
src/audio-conversation.ts → lib/audio-conversation.js, lib/audio-conversation.mjs...
created lib/audio-conversation.js, lib/audio-conversation.mjs in 353ms
src/common.ts → lib/common.js, lib/common.mjs...
created lib/common.js, lib/common.mjs in 317ms
src/conversation.ts → lib/conversation.js, lib/conversation.mjs...
[!] (plugin rpt2) Error: /Users/qyarbrough/repos/dabolus/nodejs-assistant/src/conversation.ts(59,24): semantic error TS2769: No overload matches this call.
Overload 1 of 3, '(chunk: AssistRequest, cb?: Function): void', gave the following error.
Argument of type '(err: Error) => void' is not assignable to parameter of type 'AssistRequest'.
Property 'audioIn' is missing in type '(err: Error) => void' but required in type '{ audioIn: Buffer; config?: never; }'.
Overload 2 of 3, '(chunk: AssistRequest, encoding?: any, cb?: Function): void', gave the following error.
Argument of type '(err: Error) => void' is not assignable to parameter of type 'AssistRequest'.
Type '(err: Error) => void' is not assignable to type '{ audioIn: Buffer; config?: never; }'.
src/conversation.ts
This is the codeblock that the compiler is error'ing on (~line 59):
public end(): Promise<void> {
return new Promise((resolve, reject) => {
this._stream.end((err: Error) => {
if (err) {
reject(err);
} else {
resolve();
}
});
});
}
Related to #30, may fix or get one step closer to running on Mac M1
I found a similar PR that upgrades to @grpc at https://github.com/stephenh/ts-proto/pull/401 -- but looks like they didn't run into TS errors on upgrade.