Skip to content

Don't use "long" in Proto types #2386

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

Merged
merged 1 commit into from
Nov 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/firestore/src/protos/firestore_proto_api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export declare namespace firestoreV1ApiClientInterfaces {
booleanValue?: boolean;
integerValue?: string;
doubleValue?: number;
timestampValue?: string | { seconds: long; nanos: long };
timestampValue?: string | { seconds: string; nanos: number };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm. I wonder if this should technically be string|number ? I don't think it's required to send seconds as a string, but we do to avoid number overflows.

I don't care strongly though. If it compiles, then it's good enough for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are right, but that breaks our internal type:

// This is a supplement to the generated proto interfaces, which fail to account
// for the fact that a timestamp may be encoded as either a string OR this.
interface TimestampProto {
  seconds?: string;
  nanos?: number;
}

That's why I just use strings.

stringValue?: string;
bytesValue?: string | Uint8Array;
referenceValue?: string;
Expand Down