-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
[@types/mongoose]: fix array handling in create #45355
[@types/mongoose]: fix array handling in create #45355
Conversation
@andreialecu Thank you for submitting this PR! Code ReviewsBecause you edited one package and updated the tests (👏), I can help you merge this PR once someone else signs off on it. Status
All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes. Diagnostic Information: What the bot saw about this PR{
"type": "info",
"now": "-",
"pr_number": 45355,
"author": "andreialecu",
"owners": [
"horiuchi",
"lukasz-zak",
"jendrikw",
"ethanresnick",
"vologab",
"jussikinnula",
"ondratra",
"alfirin",
"idandrd",
"various89",
"Fazendaaa",
"NormanPerrin",
"stablio",
"emmanuelgautier",
"frontendmonster",
"mingchen",
"penumbra1",
"orblazer",
"HughKu",
"niuware",
"vladmel1234",
"jloveridge",
"grimmer0125",
"richarddd",
"ToucheSir",
"borfig",
"dinodeSimon",
"anthony-kenikh",
"iamchathu",
"lkho",
"tomyam1",
"nephix",
"rlaace423",
"ChazEpps",
"avaly",
"JanNemcik",
"cl3dson",
"richardsimko",
"ith",
"jeremyben",
"andreialecu",
"tHBp"
],
"dangerLevel": "ScopedAndTested",
"headCommitAbbrOid": "8c5494c",
"headCommitOid": "8c5494cbfe2dcf41e36b080428e29a3e45f28ce4",
"mergeIsRequested": true,
"stalenessInDays": 0,
"lastCommitDate": "2020-06-18T12:22:56.000Z",
"reopenedDate": "2020-06-08T18:20:31.000Z",
"lastCommentDate": "2020-06-18T13:05:21.000Z",
"reviewLink": "https://github.com/DefinitelyTyped/DefinitelyTyped/pull/45355/files",
"hasMergeConflict": false,
"authorIsOwner": true,
"isFirstContribution": false,
"popularityLevel": "Popular",
"anyPackageIsNew": false,
"packages": [
"mongoose"
],
"files": [
{
"filePath": "types/mongoose/index.d.ts",
"kind": "definition",
"package": "mongoose"
},
{
"filePath": "types/mongoose/test/model.ts",
"kind": "test",
"package": "mongoose"
}
],
"hasDismissedReview": false,
"ciResult": "pass",
"lastReviewDate": "2020-06-18T13:00:35.000Z",
"reviewersWithStaleReviews": [],
"approvalFlags": 2,
"isChangesRequested": false
} |
🔔 @horiuchi @lukasz-zak @jendrikw @ethanresnick @vologab @jussikinnula @ondratra @alfirin @idandrd @various89 @Fazendaaa @NormanPerrin @stablio @emmanuelgautier @frontendmonster @mingchen @penumbra1 @orblazer @HughKu @niuware @Vladmel1234 @jloveridge @grimmer0125 @richarddd @ToucheSir @borfig @dinodeSimon @anthony-kenikh @iamchathu @lkho @tomyam1 @nephix @rlaace423 @chazepps @avaly @JanNemcik @cl3dson @richardsimko @ith @jeremyben @tHBp - please review this PR in the next few days. Be sure to explicitly select |
Inspecting the JavaScript source for this package found some properties that are not in the .d.ts files. mongoose (unpkg)was missing the following properties:
as well as these 7 other properties...ObjectId, Decimal128, Mixed, Number, now, CastError, SchemaTypeOptions |
👋 Hi there! I’ve run some quick measurements against master and your PR. These metrics should help the humans reviewing this PR gauge whether it might negatively affect compile times or editor responsiveness for users who install these typings. Let’s review the numbers, shall we?
Looks like there were a couple significant differences—take a look at worst-case duration for getting completions at a position to make sure everything looks ok. |
I'm the original author of the |
Updated numbers for you here from 875b47e. Nice job, these numbers look better. Comparison details 📊
It looks like nothing changed too much. I won’t post performance data again unless it gets worse. |
Updated numbers for you here from 507c871. Comparison details 📊
Looks like there were a couple significant differences—take a look at worst-case duration for getting completions at a position to make sure everything looks ok. |
Performance is slightly |
Any chance we can get an aye in from another module owner? ( Looks good in general to me ) |
Bump? |
Looks good to me as well. selfRefArray?: (ModelWithFunction | mongodb.ObjectID | undefined)[]; Usually, when I want to mark a field as an array of references (to be populated), I go with this union: selfRefArray?: ModelWithFunction[] | mongodb.ObjectID[]; which is closer the the behavior of I just want to make sure either way is fine. |
I will add a test shortly for that too @jeremyben to ensure it doesn't regress in the future. The test is written that way to expose an edge case which was occuring in |
Alright, test added and passing @jeremyben |
Ready to merge |
I just published |
Updated numbers for you here from cf000ce. Nice job, these numbers look better. Comparison details 📊
It looks like nothing changed too much. I won’t post performance data again unless it gets worse. |
…g in create by @andreialecu * fix(mongoose): enum arrays in .create() * fix optionals changing to non nullable * update tests * revert previous commit and fix properly * fix undefined in array, and simplify type * cleanup * add additional tests
…g in create by @andreialecu * fix(mongoose): enum arrays in .create() * fix optionals changing to non nullable * update tests * revert previous commit and fix properly * fix undefined in array, and simplify type * cleanup * add additional tests
This PR fixes two edge cases when using the new types added for
.create()
.I have added two tests that were previously failing.
Reported on typegoose/typegoose#290
Please fill in this template.
npm test
.)npm run lint package-name
(ortsc
if notslint.json
is present).Select one of these and delete the others:
If changing an existing definition:
tslint.json
containing{ "extends": "dtslint/dt.json" }
. If for reason the any rule need to be disabled, disable it for that line using// tslint:disable-next-line [ruleName]
and not for whole package so that the need for disabling can be reviewed.