-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
[chai] add support for Set and Map to assert.lengthOf #66744
[chai] add support for Set and Map to assert.lengthOf #66744
Conversation
@na-trium-144 Thank you for submitting this PR! I see this is your first time submitting to DefinitelyTyped 👋 — I'm the local bot who will help you through the process of getting things through. This is a live comment which I will keep updated. 1 package in this PRCode ReviewsBecause you edited one package and updated the tests (👏), I can help you merge this PR once someone else signs off on it. You can test the changes of this PR in the Playground. 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": 66744,
"author": "na-trium-144",
"headCommitOid": "3f3b729d675692dae60c4eb6b723a022b32bf757",
"mergeBaseOid": "6602670baf21cae33938757102eedc4ff6dbb3dc",
"lastPushDate": "2023-09-19T07:34:58.000Z",
"lastActivityDate": "2023-10-10T00:28:30.000Z",
"maintainerBlessed": "Waiting for Code Reviews",
"mergeOfferDate": "2023-10-09T16:43:05.000Z",
"mergeRequestDate": "2023-10-10T00:28:30.000Z",
"mergeRequestUser": "na-trium-144",
"hasMergeConflict": false,
"isFirstContribution": true,
"tooManyFiles": false,
"hugeChange": false,
"popularityLevel": "Critical",
"pkgInfo": [
{
"name": "chai",
"kind": "edit",
"files": [
{
"path": "types/chai/chai-tests.ts",
"kind": "test"
},
{
"path": "types/chai/index.d.ts",
"kind": "definition"
}
],
"owners": [
"Bartvds",
"AGBrown",
"olivr70",
"mwistrand",
"shaunluttin",
"micksatana",
"ErikSchierboom",
"bparan",
"CXuesong",
"joeykilpatrick"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Critical"
}
],
"reviews": [
{
"type": "approved",
"reviewer": "jakebailey",
"date": "2023-10-09T16:42:20.000Z",
"isMaintainer": true
}
],
"mainBotCommentID": 1724980718,
"ciResult": "pass"
} |
🔔 @Bartvds @AGBrown @olivr70 @mwistrand @shaunluttin @micksatana @ErikSchierboom @bparan @CXuesong @joeykilpatrick — please review this PR in the next few days. Be sure to explicitly select |
Re-ping @Bartvds, @AGBrown, @olivr70, @mwistrand, @shaunluttin, @micksatana, @ErikSchierboom, @bparan, @CXuesong, @joeykilpatrick: This PR has been out for over a week, yet I haven't seen any reviews. Could someone please give it some attention? Thanks! |
It has been more than two weeks and this PR still has no reviews. I'll bump it to the DT maintainer queue. Thank you for your patience, @na-trium-144. (Ping @Bartvds, @AGBrown, @olivr70, @mwistrand, @shaunluttin, @micksatana, @ErikSchierboom, @bparan, @CXuesong, @joeykilpatrick.) |
@@ -1210,7 +1210,11 @@ declare namespace Chai { | |||
* @param length Potential expected length of object. | |||
* @param message Message to display on error. | |||
*/ | |||
lengthOf<T extends { readonly length?: number | undefined }>(object: T, length: number, message?: string): void; | |||
lengthOf<T extends { readonly length?: number | undefined } | { readonly size?: number | undefined }>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a new problem, but I don't understand why this is a generic at all. It could just accept this constraint as the parameter type.
That and, this type technically accepts the literal {}
as an argument, which feels wrong.
@na-trium-144: Everything looks good here. I am ready to merge this PR (at 3f3b729) on your behalf whenever you think it's ready. If you'd like that to happen, please post a comment saying:
and I'll merge this PR almost instantly. Thanks for helping out! ❤️ (@Bartvds, @AGBrown, @olivr70, @mwistrand, @shaunluttin, @micksatana, @ErikSchierboom, @bparan, @CXuesong, @joeykilpatrick: you can do this too.) |
Ready to merge |
Documentation of chai says that I can check the size property of objects such as Set or Map with
assert.lengthOf
, but TypeScript gives error:Type 'Map<string, number>' has no properties in common with type '{ readonly length?: number | undefined; }'.
This PR fixes this error.
Please fill in this template.
npm test <package to test>
.Select one of these and delete the others:
If changing an existing definition: