Skip to content

Make MaybeDocument an abstract class #1153

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 2 commits into from
Aug 21, 2018
Merged

Conversation

schmidt-sebastian
Copy link
Contributor

... with the class comments from Android.

* Represents a document in Firestore with a key, version, data and whether the
* data has local mutations applied to it.
*/
export class Document implements MaybeDocument {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be extends rather than implements?

Here and below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I would have hoped that TS complains about things like this.

@@ -68,7 +81,7 @@ export class Document {
);
}

static compareByKey(d1: MaybeDocument, d2: MaybeDocument): number {
static compareByKey(d1: Document, d2: Document): number {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why shouldn't this accept MaybeDocument?

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 moved this method up to the base class and changed it to accept MaybeDocument. I just thought it was odd that it accepts MaybeDocument, but is part of a subclass.

@wilhuff
Copy link
Contributor

wilhuff commented Aug 21, 2018

CI failed to build on this error:

TS2345 Argument of type 'MaybeDocument' is not assignable to parameter of type 'Document'.\n Property 'hasLocalMutations' is missing in type 'MaybeDocument'

@schmidt-sebastian
Copy link
Contributor Author

Feedback addressed. Build passing :)

Copy link
Contributor

@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

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

LGTM

@wilhuff wilhuff assigned schmidt-sebastian and unassigned wilhuff Aug 21, 2018
@schmidt-sebastian schmidt-sebastian merged commit 76c2772 into master Aug 21, 2018
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt-maybedocument branch September 5, 2018 18:22
@firebase firebase locked and limited conversation to collaborators Oct 17, 2019
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