We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
useOptionals=all
forceLong=long
Steps to reproduce
// example.proto syntax = "proto3"; import "google/protobuf/timestamp.proto"; message Example { google.protobuf.Timestamp datetime = 1; }
and then run:
protoc \ --plugin=./node_modules/.bin/protoc-gen-ts_proto \ --ts_proto_opt=useOptionals=all \ --ts_proto_opt=forceLong=long \ --ts_proto_out=. \ example.proto
The generated ts file will have a compilation error in the following function:
function fromTimestamp(t: Timestamp): Date { let millis = (t.seconds.toNumber() || 0) * 1_000; // ^^^^^^^^^ // 't.seconds' is possibly 'undefined'.ts(18048) millis += (t.nanos || 0) / 1_000_000; return new globalThis.Date(millis); }
Expected output
function fromTimestamp(t: Timestamp): Date { let millis = (t.seconds?.toNumber() || 0) * 1_000; millis += (t.nanos || 0) / 1_000_000; return new globalThis.Date(millis); }
The text was updated successfully, but these errors were encountered:
🎉 This issue has been resolved in version 1.161.1 🎉
The release is available on:
v1.161.1
Your semantic-release bot 📦🚀
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Steps to reproduce
and then run:
The generated ts file will have a compilation error in the following function:
Expected output
The text was updated successfully, but these errors were encountered: