[@types/underscore] Collection and Array Tests - Where, FindWhere, Shuffle, and Sample#46035
Conversation
|
@reubenrybnik Thank you for submitting this PR! This is a live comment which I will keep updated. 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": 46035,
"author": "reubenrybnik",
"owners": [
"borisyankov",
"jbaldwin",
"ccurrens",
"confususs",
"jgonggrijp",
"ffflorian",
"regevbr",
"peterblazejewicz",
"reubenrybnik"
],
"dangerLevel": "ScopedAndTested",
"headCommitAbbrOid": "a702ec5",
"headCommitOid": "a702ec534210c6c37684ed0923c519dc77e5926a",
"mergeIsRequested": true,
"stalenessInDays": 0,
"lastPushDate": "2020-07-14T06:37:48.000Z",
"lastCommentDate": "2020-07-15T13:54:06.000Z",
"maintainerBlessed": false,
"reviewLink": "https://github.com/DefinitelyTyped/DefinitelyTyped/pull/46035/files",
"hasMergeConflict": false,
"authorIsOwner": true,
"isFirstContribution": false,
"popularityLevel": "Popular",
"anyPackageIsNew": false,
"packages": [
"underscore"
],
"files": [
{
"path": "types/underscore/index.d.ts",
"kind": "definition",
"package": "underscore"
},
{
"path": "types/underscore/underscore-tests.ts",
"kind": "test",
"package": "underscore"
}
],
"hasDismissedReview": false,
"ciResult": "pass",
"lastReviewDate": "2020-07-14T11:45:41.000Z",
"reviewersWithStaleReviews": [],
"approvalFlags": 2,
"isChangesRequested": false
} |
|
🔔 @borisyankov @jbaldwin @ccurrens @confususs @jgonggrijp @ffflorian @regevbr @peterblazejewicz — please review this PR in the next few days. Be sure to explicitly select |
…of type union cases.
|
👋 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? Comparison details 📊
It looks like nothing changed too much. I won’t post performance data again unless it gets worse. |
jgonggrijp
left a comment
There was a problem hiding this comment.
I have some concerns about your tests, but I totally agree with your type declarations.
|
@reubenrybnik One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits or comments. If you disagree with the reviewer's comments, you can "dismiss" the review using GitHub's review UI. Thank you! |
|
@reubenrybnik The CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
|
@jgonggrijp Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review? |
…erent types of collection items.
jgonggrijp
left a comment
There was a problem hiding this comment.
I'm happy with it as is, but if you decide to add a workaround for the Partial<any[]> problem, I'll happily press "approve" again.
|
There are two new errors in my company's solution with these changes. Both are caused by explicitly specified generics for This set of functions aren't ones that we tend to use very often, so this admittedly isn't necessarily as useful a check this time around as it has been in previous PRs. |
|
Oh yeah, and also this error which per the discussion seems like it's likely a good error to surface. |
|
Ready to merge |
|
I just published |
…rray Tests - Where, FindWhere, Shuffle, and Sample by @reubenrybnik * Updating type definitions for where, findWhere, shuffle, and sample and adding tests. * Fixing a test group comment in map that was missing its collection type differentiator. * Adding "any" tests for where and findWhere. * Fixing various issues. * Adding a pair of tests to verify that Partial works well with a pair of type union cases. * Updating chained-together tests for where, findWhere, shuffle, and sample to make more sense in the real world. * Dropping the word "inline" from a comment. * Adding a test that chains where up with previously updated functions. * Adding sample into the mix and swapping out map for pluck. * Fixing a CI failure. * Using different parameter names for iteratees that interact with different types of collection items.
npm test.)npm run lint package-name(ortscif notslint.jsonis present).This PR continues the planned set that will together add up to #45201 and includes the following changes:
where,findWhere,shuffle, andsample.whereandfindWhereto take aPartial<T>instead of an object to provide better autocomplete support where available and provide an error for inline object declarations with no matching properties.samplein whichnis not provided to includeundefinedas a possible result (for the case where an empty collection is provided)._Chain.findWhereto include undefined.Tgeneric inUnderscore.sampleand_Chain.samplewhich will fix Inaccurate typings for underscore's _.sample method #20440 for those functions._Chain.where,_Chain.shuffle, and_Chain.sampleto use the correct wrapped value typeVto partially fix @types/underscore error TS2322 for_.chainafter upgrade to v1.9 #36308.UnderscoreStatic.whereandUnderscoreStatic.findWhereto work with both Lists and Dictionaries to partially fix Underscore collections functions should take objects #20623.