grpc-node
grpc-node copied to clipboard
Fix ts errors with typescript 4.6.3 #2107
This fixes couple typescript files failing to transpile with typescript 4.6.x. Typescript 4.6 enforces object's default type to be 'unknown', instead of 'any' and no implicit the argument value for the resolve call.
The transpilation errors under typescript 4.6: a. Object is of type 'unknown' b. Argument of type 'unknown' is not assignable to parameter of type XYZ c. Expected 1 arguments, but got 0. Did you forget to include 'void' in your type argument to 'Promise'?
To repro:
- cd packages/grpc-js
- npm install
- npm install [email protected]
- npm run build
- :x: The commit (9c3c687af5a0560afa08da383a1f9973157f2b57). This user is missing the User's ID, preventing the EasyCLA check. Consult GitHub Help to resolve.For further assistance with EasyCLA, please submit a support request ticket.
We don't currently use that version of the compiler, so these issues do not impact us. Why do you want to make this change?
I can live with other typescript 4.x versions you prefer. Any plans to move up the 4.x? I think it has been released more than a year.
Is there some specific reason that you want this package to switch to using TypeScript 4.x?
Apps with ts 4.x is unable to consume current grpc-js release build with ts 3.x implementation. Transpilation fails.
If you are having a problem with using grpc-js, please file an issue with the details of that problem.
The pr description has transpilation errors, repro steps and ts changes that builds.
Sure. I can create a ticket.
I understand that this package does not build with a different compiler version. What I am asking for is an actual use case that is actually impacted by this incompatibility. If you npm install
the library, can you use it?
It is when npm install a grpc-js build in any apps using ts 4.x, the npm run build
would fail.
As to the reasons of why I use TS 4.x:
- TS 4.x language features. https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-0.html
- Better toolchain, perf and features.
I cannot reproduce this failure you are describing. Please provide a specific sequence of actions to reproduce it.
Can you do a "npm install" before the typescript 4.x install command? I have revised the steps as follows.
- cd packages/grpc-js
- npm install
- npm install [email protected]
- npm run build
You said
when npm install a grpc-js build in any apps using ts 4.x, the
npm run build
would fail.
Cloning this repository and changing the compiler version is not the normal procedure to use this package in an app. Did you experience a problem with the @grpc/grpc-js
package when installing it from the npm repository?
What about skipping publish of source files?
Won't it be enough to just publish .d.ts
and .js
files and just ignore .ts
files?