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

Mongoose populate #2928

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

maxaggedon
Copy link
Contributor

@villesau
Copy link
Member

Hi @maxaggedon! Looks like the libdef is failing on 0.85.0. The reason is that 0.85.0 is much stricter with type annotations, see: https://medium.com/flow-type/asking-for-required-annotations-64d4f9c1edf8

Would you be willing to fix those issues too?

@maxaggedon
Copy link
Contributor Author

Hi @villesau ! I did the same fixes for v5 ;)

@@ -2,7 +2,7 @@

import mongoose, { Schema } from "mongoose";

export const AdminSchema = new Schema(
export const AdminSchema: Mongoose$Schema<AdminDoc> = new Schema(
Copy link
Member

Choose a reason for hiding this comment

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

I think that in this case you want to use type parameters like export const AdminSchema = new Schema<Mongoose$Schema<AdminDoc>>(... ?

Copy link
Member

Choose a reason for hiding this comment

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

Flow added support for these few versions back.

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 just tried it like new Schema<AdminDoc>(...) but I get a Missing type annotation for 'Mongoose$Schema' again. Did not figure out why...

@mi6gan
Copy link

mi6gan commented Nov 7, 2018

Callback-version of Document#populate is not purposed to return anything at all. So, imo, it would be better and cleaner to add a separate definition to callback-less version, like this one:

populate(path: string): this;

@villesau villesau self-assigned this Aug 9, 2019
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 this pull request may close these issues.

None yet

3 participants