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

Conversation

schmidt-sebastian
Copy link
Contributor

"long" is not defined and throws a diagnostic error:

Error: TypeScript Diagnostic Error : ../../firebase/firebase-js-sdk/packages/firestore/src/protos/firestore_proto_api.d.ts(366,42): error TS2304: Cannot find name 'long'.

@@ -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.

@schmidt-sebastian schmidt-sebastian merged commit d1cd07d into master Nov 27, 2019
@hsubox76 hsubox76 added this to the 7.5.1 milestone Dec 12, 2019
@firebase firebase locked and limited conversation to collaborators Dec 28, 2019
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/fixtypes branch February 28, 2020 23:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants