@google-cloud/pubsub": "^1.7.2"を使い、tscしたところ下記のエラーが出た。
node_modules/@grpc/grpc-js/build/src/call.d.ts:68:5 - error TS2416: Property '_write' in type 'ClientWritableStreamImpl<RequestType>' is not assignable to the same property in base type 'Writable'. Type '(chunk: RequestType, encoding: string, cb: WriteCallback) => void' is not assignable to type '(chunk: any, encoding: string, callback: (err?: Error | undefined) => void) => void'. Types of parameters 'cb' and 'callback' are incompatible. Types of parameters 'err' and 'error' are incompatible. Type 'Error | null | undefined' is not assignable to type 'Error | undefined'. Type 'null' is not assignable to type 'Error | undefined'. 68 _write(chunk: RequestType, encoding: string, cb: WriteCallback): void; ~~~~~~ node_modules/@grpc/grpc-js/build/src/call.d.ts:79:5 - error TS2416: Property '_write' in type 'ClientDuplexStreamImpl<RequestType, ResponseType>' is not assignable to the same property in base type 'Duplex'. Type '(chunk: RequestType, encoding: string, cb: WriteCallback) => void' is not assignable to type '(chunk: any, encoding: string, callback: (err?: Error | undefined) => void) => void'. Types of parameters 'cb' and 'callback' are incompatible. Types of parameters 'err' and 'error' are incompatible. Type 'Error | null | undefined' is not assignable to type 'Error | undefined'. Type 'null' is not assignable to type 'Error | undefined'. 79 _write(chunk: RequestType, encoding: string, cb: WriteCallback): void;
バージョンを確認した所、1.7.2が新しめだったので1.6.0に戻し、念の為node_modulesを削除して再インストールしたところ問題なくコンパイルできた。
www.npmjs.com
package.json
"dependencies": { "@google-cloud/pubsub": "^1.6.0",
2系がもう少しで出るらしいので、バタバタしてるのかな。