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

Starting with timostamm-protobuf-ts@v2.9.4 the "output_javascript" option no longer emits .d.ts files #1162

Closed
sourishkrout opened this issue Apr 8, 2024 · 4 comments · Fixed by #1163

Comments

@sourishkrout
Copy link

sourishkrout commented Apr 8, 2024

Superseding timostamm/protobuf-ts#643 (comment) since the issue does not occur in the upstream project.

Starting with https://github.com/bufbuild/plugins/tree/main/plugins/community/timostamm-protobuf-ts/v2.9.4 when I generate code for the protos here: https://github.com/stateful/runme/tree/main/internal/api important *.d.ts files are being omitted. A downgrade to v2.9.3 solves the issue. Please note, if I use the upstream project directly (outside of Buf), I can not reproduce the issue.

Happy to refactor my proto files if that will fix the issue but I don't have an inclination how to do that. Please advise! Thank you.

Here's one of the key differences, v2.9.4; please note how the parser_pb.d.ts is absent:

internal/gen/proto/ts/runme/parser
└── v1
    ├── parser_pb.client.d.ts
    ├── parser_pb.client.js
    └── parser_pb.js

2 directories, 3 files

And here's v2.9.3:

internal/gen/proto/ts/runme/parser
└── v1
    ├── parser_pb.client.d.ts
    ├── parser_pb.client.js
    ├── parser_pb.d.ts
    └── parser_pb.js

2 directories, 4 files
@pkwarren
Copy link
Member

pkwarren commented Apr 8, 2024

I was not able to reproduce the same behavior with the buf.build/connectrpc/eliza module - it generates .d.ts files for each input file properly:

buf.gen.yaml:

version: v1
managed:
  enabled: true
plugins:
  - plugin: buf.build/community/timostamm-protobuf-ts
    out: gen/timo-ts
  - plugin: buf.build/community/timostamm-protobuf-ts
    out: gen/timo-js
    opt: output_javascript

Output:

$ tree gen 
gen
├── timo-js
│   └── connectrpc
│       └── eliza
│           └── v1
│               ├── eliza.client.d.ts
│               ├── eliza.client.js
│               ├── eliza.d.ts
│               └── eliza.js
└── timo-ts
    └── connectrpc
        └── eliza
            └── v1
                ├── eliza.client.ts
                └── eliza.ts

I'm interested to know if you can reproduce this behavior with a public module on the BSR. In the meantime I've opened #1163 to revert a recent change we made to the plugin to reduce its size.

@sourishkrout
Copy link
Author

sourishkrout commented Apr 8, 2024

@pkwarren yes, the public BSR would be https://buf.build/stateful/runme/activity/

Namely: npm install @buf/stateful_runme.community_timostamm-protobuf-ts@latest will pull in a v2.9.4 bundled version without *.d.ts whereas npm install @buf/stateful_runme.community_timostamm-protobuf-ts@2.9.3-20240406201323-8223854c0c39.1 continues to work and includes those files.

I can't seem to reopen this issue.

@pkwarren
Copy link
Member

pkwarren commented Apr 8, 2024

@sourishkrout - This should be resolved with version v2.9.4, revision 3 of the plugin. I've verified with code generation locally that these previously missing files are now found:

google/protobuf/descriptor.d.ts
google/protobuf/wrappers.d.ts
runme/parser/v1/parser.d.ts
runme/runner/v1/runner.d.ts
runme/runner/v2alpha1/runner.d.ts

@sourishkrout
Copy link
Author

Thank you! Much appreciated.

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

Successfully merging a pull request may close this issue.

2 participants