-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Any good way to generate TypeScript definition for static .js files from pbjs ? #550
Comments
Give it a try! (use |
First, thanks for adding this feature. I installed the latest version to test out pbts and it works if the *.proto files do NOT include a package statement. With a package statement, the generated d.ts only contains single var with the package name. See attached proto files and generated output in the zip. nopackage.proto: Does not have a package and generates the correct nopackage.d.ts Test steps
Thanks much. |
Does this fix it? |
Yes, the generated d.ts looks good. I need to test with some typescript code to verify the types but visual inspection is a "pass". Thanks again. |
Must use absolute path ?This get error
and this works |
Nested classes are not generated properly with pbts. In typescript definition, nested classes must be added to a module whose name is the same as the parent class:
should give:
|
@twoeo: Did you mean |
@osechet: That doesn't appear correct to me. Or is it? The dts of the library itself doesn't use something like this and validates properly against latest dev typescript |
@dcodeIO The concept of nested class does not exist in Typescript. The only way to make something equivalent is the way I described. You can find a lot of resources on Internet that explains it, i.e: But I think it's a problem with tsd-jsdoc. I remember running into a similar problem last time I used it. |
Can you provide me with an example output that fails? |
@twoeo: This commit should fix the absolute path issue you described. Also make sure that the tsd-jsdoc dependency is updated to current master (there has been an issue with piped output). |
…h our changes incorporated for issues/prs, see #550
I've restructured tsd-jsdoc and incorporated our changes, which is now part of this repository. There are a few more comments on what the different functions actually do making the code relatively easy to understand. Hence, it's now possible to process issues and PRs. |
As tsd-jsdoc puts inner classes into modules now and all other issues mentioned seem to be resolved, I am closing this for now. Feel free to create new issues or PRs referencing lib/jsdoc directly. |
See that protobuf.js generate .d.ts via jsdoc, it is useful for dynamic use case.
While for static code generate, any good way to generate this ?
The text was updated successfully, but these errors were encountered: