Grpc-web: Add Typescript definition file for the grpc-web npm package

Created on 21 Aug 2018  Â·  7Comments  Â·  Source: grpc/grpc-web

Now that the grpcweb runtime is available as an npm package 🎉 🎉 , it would be even better if the package could include a Typescript definition file as well. This way, it would be much easier to consume the grpcweb runtime from Typescript code.

If this isn't feasible I'm thinking about submitting a d.ts file to definitely typed but this is not the best solution.

Most helpful comment

I might be able to contribute a new file with the basic outline this week.

All 7 comments

We definitely have plan to add an index.d.ts file to the npm package. I tried to use an internal version of the Angular Clutz tool to generate the .d.ts typings - it _sort-of_ works but the output is just a bunch of any and it has these declare namespace ಠ_ಠ.clutz { thing.

The grpc node package hand-writes their index.d.ts file so I might have to do that and it might take a while.

Does anybody know of any other closure to typescript typings generator I can try? Or is there someone with more Typescript experience who can start a general structure of the desired index.d.ts file and I can certainly contribute to the rest of the content? Contributions are definitely welcome!

I might be able to contribute a new file with the basic outline this week.

This would be fantastic!

On Tue, 21 Aug 2018 at 20:42, Jonah Dahlquist notifications@github.com
wrote:

I might be able to contribute a new file with the basic outline this week.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/grpc/grpc-web/issues/255#issuecomment-414780063, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ACIPluKO1SEuyR19PjUjjOaMtBC2J_F6ks5uTFSbgaJpZM4WFz4o
.

I started a PR #258 to show how the index.d.ts might work. Any feedback appreciated!

PR #258 merged. The index.d.ts typings should be making it into the next release 0.4.0 currently planned for next week.

After that user should be able to do import * as grpcWeb from 'grpc-web'; after an npm i grpc-web.

Great! Thanks for adding this @stanley-cheung .

The npm package version 0.4.0 has been pushed. Please try it out!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

graup picture graup  Â·  4Comments

jmzwcn picture jmzwcn  Â·  6Comments

dv29 picture dv29  Â·  6Comments

TBoshoven picture TBoshoven  Â·  4Comments

pumano picture pumano  Â·  6Comments