Skip to content

[@types/underscore] Collection and Array Tests - Zip, Unzip, and Object#46306

Merged
typescript-bot merged 10 commits intoDefinitelyTyped:masterfrom
reubenrybnik:underscore-tests-zip-unzip-object
Jul 28, 2020
Merged

[@types/underscore] Collection and Array Tests - Zip, Unzip, and Object#46306
typescript-bot merged 10 commits intoDefinitelyTyped:masterfrom
reubenrybnik:underscore-tests-zip-unzip-object

Conversation

@reubenrybnik
Copy link
Copy Markdown
Contributor

@reubenrybnik reubenrybnik commented Jul 24, 2020

  • 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.)
  • Add or edit tests to reflect the change. (Run with npm test.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).
  • Provide a URL to documentation or source code which provides context for the suggested changes: https://underscorejs.org/
  • Include tests for your changes

This PR continues the planned set that will together add up to #45201 and includes the following changes:

  • Adds tests for zip, unzip, and object.
  • Removes an overload of UnderscoreStatic.zip that doesn't seem like it's correct.
  • Updates unzip functions to not take more than a single input (either a single parameter or the wrapped value).
  • Collapses object to a single overload that always results in a Dictionary of some sort rather than allowing the caller to specify a more exact result through generics and infers its resulting value type when it can, falling back to any when it can't.
  • Updates the return type of the _Chain functions to use the correct wrapped value type V (these are more drastic changes than those that partially fix @types/underscore error TS2322 for _.chain after upgrade to v1.9 #36308 though).

@typescript-bot typescript-bot added Popular package This PR affects a popular package (as counted by NPM download counts). Author is Owner The author of this PR is a listed owner of the package. labels Jul 24, 2020
@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Jul 24, 2020

@reubenrybnik Thank you for submitting this PR!

This is a live comment which I will keep updated.

Code Reviews

Because you edited one package and updated the tests (👏), I can help you merge this PR once someone else signs off on it.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ✅ Most recent commit is approved by type definition owners or DT maintainers

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": 46306,
  "author": "reubenrybnik",
  "owners": [
    "borisyankov",
    "jbaldwin",
    "ccurrens",
    "confususs",
    "jgonggrijp",
    "ffflorian",
    "regevbr",
    "peterblazejewicz",
    "reubenrybnik"
  ],
  "dangerLevel": "ScopedAndTested",
  "headCommitAbbrOid": "db3c2d5",
  "headCommitOid": "db3c2d5aebf4f55de033a060b7f1b1cdec9ad1f1",
  "mergeIsRequested": true,
  "stalenessInDays": 0,
  "lastPushDate": "2020-07-27T23:22:51.000Z",
  "lastCommentDate": "2020-07-28T13:10:18.000Z",
  "maintainerBlessed": false,
  "reviewLink": "https://github.com/DefinitelyTyped/DefinitelyTyped/pull/46306/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-28T07:23:29.000Z",
  "reviewersWithStaleReviews": [],
  "approvalFlags": 2,
  "isChangesRequested": false
}

@typescript-bot
Copy link
Copy Markdown
Contributor

🔔 @borisyankov @jbaldwin @ccurrens @confususs @jgonggrijp @ffflorian @regevbr @peterblazejewicz — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

@typescript-bot
Copy link
Copy Markdown
Contributor

👋 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 📊
master #46306 diff
Batch compilation
Memory usage (MiB) 55.8 57.0 +2.2%
Type count 11574 11734 +1%
Assignability cache size 1407 1431 +2%
Language service
Samples taken 6467 6553 +1%
Identifiers in tests 6467 6553 +1%
getCompletionsAtPosition
    Mean duration (ms) 192.3 184.3 -4.2%
    Mean CV 8.6% 8.7%
    Worst duration (ms) 373.6 353.5 -5.4%
    Worst identifier filter _
getQuickInfoAtPosition
    Mean duration (ms) 187.5 179.8 -4.1%
    Mean CV 8.8% 9.0% +2.2%
    Worst duration (ms) 382.9 356.4 -6.9%
    Worst identifier extractChainTypes extractChainTypes

It looks like nothing changed too much. I won’t post performance data again unless it gets worse.

@typescript-bot typescript-bot added the Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. label Jul 24, 2020
Copy link
Copy Markdown
Contributor

@jgonggrijp jgonggrijp left a comment

Choose a reason for hiding this comment

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

Great job again. I would prefer separate overloads for the one- and two-argument signatures of object, but otherwise I'm very happy with these changes.

@typescript-bot typescript-bot added the Revision needed This PR needs code changes before it can be merged. label Jul 26, 2020
@typescript-bot
Copy link
Copy Markdown
Contributor

@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!

@typescript-bot typescript-bot removed the Revision needed This PR needs code changes before it can be merged. label Jul 26, 2020
…y/value lists and making the result Dictionary<never> when a list of incorrect depth is supplied.
@typescript-bot
Copy link
Copy Markdown
Contributor

@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?

Co-authored-by: Julian Gonggrijp <dev@juliangonggrijp.com>
@typescript-bot typescript-bot added the The CI failed When GH Actions fails label Jul 27, 2020
@typescript-bot
Copy link
Copy Markdown
Contributor

@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!

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

@jgonggrijp I've made all the revisions I plan to for now here if you wouldn't mind taking another look whenever you have a moment. As usual, thanks for all the valuable feedback!

Copy link
Copy Markdown
Contributor

@jgonggrijp jgonggrijp left a comment

Choose a reason for hiding this comment

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

This is better again, but I have one concern. See below.

If you disagree and you manage to convince me, I'll change the verdict to "approve".

@typescript-bot typescript-bot added the Revision needed This PR needs code changes before it can be merged. label Jul 27, 2020
@typescript-bot
Copy link
Copy Markdown
Contributor

@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
Copy link
Copy Markdown
Contributor Author

Ignore this, I'm just trying out adding a comment after marking all items resolved to see if anything happens.

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

Nope.

Co-authored-by: Julian Gonggrijp <dev@juliangonggrijp.com>
@typescript-bot typescript-bot removed the Revision needed This PR needs code changes before it can be merged. label Jul 27, 2020
Copy link
Copy Markdown
Contributor

@jgonggrijp jgonggrijp left a comment

Choose a reason for hiding this comment

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

You convinced me about the constraint, but given that TS is not having it anyway, I also agree that it is still better to have it in place.

Again, good job!

@typescript-bot typescript-bot added Owner Approved A listed owner of this package signed off on the pull request. Self Merge This PR can now be self-merged by the PR author or an owner labels Jul 28, 2020
@typescript-bot
Copy link
Copy Markdown
Contributor

@reubenrybnik Everything looks good here. Great job! I am ready to merge this PR on your behalf.

If you'd like that to happen, please post a comment saying:

Ready to merge

and I'll merge this PR almost instantly. Thanks for helping out! ❤️

(@borisyankov, @jbaldwin, @ccurrens, @confususs, @jgonggrijp, @ffflorian, @regevbr, @peterblazejewicz: you can do this too.)

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

No new errors occur in my company's solution with this final set of changes.

@reubenrybnik
Copy link
Copy Markdown
Contributor Author

Ready to merge

@typescript-bot typescript-bot merged commit 3db3316 into DefinitelyTyped:master Jul 28, 2020
@typescript-bot
Copy link
Copy Markdown
Contributor

I just published @types/underscore@1.10.15 to npm.

astorije pushed a commit to astorije/DefinitelyTyped that referenced this pull request Jul 30, 2020
…rray Tests - Zip, Unzip, and Object by @reubenrybnik

* Updating type definitions for zip, unzip, and object and adding tests.

* Adding undefined to possible results of object when given separate key/value lists and making the result Dictionary<never> when a list of incorrect depth is supplied.

* Adding tests for single arguments for zip.

* Adding comments that help to explain the logic of PairValue.

* Splitting PairValue into two separate types instead of nesting logic.

* Putting an underscore in front of the ObjectValue type to help signify that it's private since unlike most of the types in this file this is really a type that's specifically a helper for the object function which typically shouldn't be used anywhere else.

* Removing a portion of the summary comments for zip since they aren't needed anymore.

* Infer the pair list type when possible instead of using `any`

Co-authored-by: Julian Gonggrijp <dev@juliangonggrijp.com>

* Making object into separate overloads.

* Constraining the list of keys to be members of EnumerableKey.

Co-authored-by: Julian Gonggrijp <dev@juliangonggrijp.com>

Co-authored-by: Julian Gonggrijp <dev@juliangonggrijp.com>
danielrearden pushed a commit to danielrearden/DefinitelyTyped that referenced this pull request Sep 22, 2020
…rray Tests - Zip, Unzip, and Object by @reubenrybnik

* Updating type definitions for zip, unzip, and object and adding tests.

* Adding undefined to possible results of object when given separate key/value lists and making the result Dictionary<never> when a list of incorrect depth is supplied.

* Adding tests for single arguments for zip.

* Adding comments that help to explain the logic of PairValue.

* Splitting PairValue into two separate types instead of nesting logic.

* Putting an underscore in front of the ObjectValue type to help signify that it's private since unlike most of the types in this file this is really a type that's specifically a helper for the object function which typically shouldn't be used anywhere else.

* Removing a portion of the summary comments for zip since they aren't needed anymore.

* Infer the pair list type when possible instead of using `any`

Co-authored-by: Julian Gonggrijp <dev@juliangonggrijp.com>

* Making object into separate overloads.

* Constraining the list of keys to be members of EnumerableKey.

Co-authored-by: Julian Gonggrijp <dev@juliangonggrijp.com>

Co-authored-by: Julian Gonggrijp <dev@juliangonggrijp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author is Owner The author of this PR is a listed owner of the package. Owner Approved A listed owner of this package signed off on the pull request. Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. Popular package This PR affects a popular package (as counted by NPM download counts). Self Merge This PR can now be self-merged by the PR author or an owner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@types/underscore error TS2322 for _.chain after upgrade to v1.9

3 participants