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

[mongodb] Added support for default generic types #16198

Merged
5 commits merged into from Jun 7, 2017

Conversation

CaselIT
Copy link
Contributor

@CaselIT CaselIT commented Apr 28, 2017

Please fill in this template.

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).

Select one of these and delete the others:

If changing an existing definition:

  • Increase the version number in the header if appropriate.
  • If you are making substantial changes, consider adding a tslint.json containing { "extends": "dslint/dt.json" }.

Added support for default types introduced in ts2.3.
Once microsoft/dtslint#31 is fixed I'll add tslint support when I have time

@dt-bot
Copy link
Member

dt-bot commented Apr 28, 2017

types/mongodb/index.d.ts

to author (@CaselIT). Could you review this PR?
👍 or 👎?

Checklist

  • pass the Travis CI test?

@CaselIT
Copy link
Contributor Author

CaselIT commented May 1, 2017

Waiting for DT to start supporting ts2.3 in about a month. See microsoft/dtslint#31 for details

//http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html
export class Cursor<T> extends Readable {
export class Cursor<T = Default> extends Readable {
Copy link
Contributor

@hinell hinell Jun 4, 2017

Choose a reason for hiding this comment

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

Don't forget to do the same for AggregationCursor<T>and remove overriding methods of Collection (like find()) that return Cursor<any> and AggregationCursor<any>. They are unnecessary 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.

You are right, I forgot to update the AggregationCursor. I'll try to do it today. Thanks for the reminder!

@yuit yuit added the Revision needed This PR needs code changes before it can be merged. label Jun 6, 2017
@CaselIT
Copy link
Contributor Author

CaselIT commented Jun 6, 2017

@yuit I've rebased and resolved the conflict.

@hinell I've updated the find and findOne methods on the collection

@CaselIT
Copy link
Contributor Author

CaselIT commented Jun 6, 2017

@andy-ms I'm not sure about the travis fail. It complains about the // TypeScript Version: 2.3 in the header which is present. Do I have to add it to all the packages that reference mongodb?

@ghost
Copy link

ghost commented Jun 6, 2017

Yes, if this is breaking other packages they will need a // TypeScript Version: 2.3 comment as well.

@CaselIT
Copy link
Contributor Author

CaselIT commented Jun 6, 2017

Thanks. I will add the version header. 👍

@CaselIT
Copy link
Contributor Author

CaselIT commented Jun 6, 2017

@andy There seem to be a bug in the types-publisher test.
It finds errors in easy-jsend and express-brute-mongo that do not reference or import any library.
Files: easy-jsend and express-brute-mongo

They do have a reference in the test file. So that may be the cause.Test of easy-jsend Test of express-brute-mongo

@CaselIT
Copy link
Contributor Author

CaselIT commented Jun 6, 2017

@andy Let me know if you prefer an issue in the types-publisher repo and adding the // TypeScript Version: 2.3 in easy-jsend and express-brute-mongo in the meantime so this pr can be merged

@ghost
Copy link

ghost commented Jun 6, 2017

I don't consider that a bug -- we will test every package using its declared version, and easy-jsend won't compile in ts2.0 any more.
Although since mongodb is mentioned nowhere in the definition of easy-jsend, you could just change the tests to not use it either.

EDIT: Actually, these libraries both seem to really depend on mongodb, but are hastily written and use any where they should be using types from mongodb. It would be great if you could fix them up, otherwise I would add // TypeScript Version: 2.3 comments.

@CaselIT
Copy link
Contributor Author

CaselIT commented Jun 6, 2017

Thanks @andy-ms for the feedback
I'll look if I can fix them, otherwise I'll just put // TypeScript Version: 2.3 in the header

@ghost ghost mentioned this pull request Jun 7, 2017
8 tasks
@CaselIT
Copy link
Contributor Author

CaselIT commented Jun 7, 2017

Should be ok now.
I've fixed the two remaining errors

@ghost
Copy link

ghost commented Jun 7, 2017

Thanks!

@ghost ghost merged commit 7fc1644 into DefinitelyTyped:master Jun 7, 2017
@CaselIT CaselIT deleted the mongodb branch November 27, 2017 21:25
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Revision needed This PR needs code changes before it can be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants