Skip to content
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

Generate typings #8

Open
michielbdejong opened this issue Oct 7, 2021 · 3 comments
Open

Generate typings #8

michielbdejong opened this issue Oct 7, 2021 · 3 comments

Comments

@michielbdejong
Copy link
Contributor

As TypeScript is gaining wide adoption in the node community, it would be good to not only produce the JavaScript client but also typings for the different message classes.

TypeScript builds on top of JavaScript, and a TypeScript binding is basically the same .js files for the code, plus separate typings files that add type information.

It seems the google-protobuf package does not support generating code+typings, but protobufjs does. I'll investigate if I can use that package to generate typings for cs3apis.

@michielbdejong
Copy link
Contributor Author

michielbdejong commented Oct 7, 2021

git clone https://github.com/cs3org/cs3apis
cd cs3apis
npm install protobufjs
./node_modules/.bin/pbjs -t static-module `find cs3 -type f -name "*.proto"` > cs3.js
./node_modules/.bin/pbts -o cs3.d.ts cs3.js 

@michielbdejong
Copy link
Contributor Author

And probably npm install --save @types/long

@michielbdejong
Copy link
Contributor Author

Downside (or upside?) is it generates a single pair of .js/.d.ts files, whereas this repo currently contains separate files.
The example would change to:

(to do)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant