-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Fix(49472): Added docs for Set and Map types #49522
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
Conversation
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.
Reading the rest of the comments, I feel the same way about nearly all of them: Some parts are valuable, the rest is redundant. @DanielRosenwasser or @andrewbranch what do you think about incomplete-but-interesting JSDoc vs complete-but-redundant?
src/lib/es2015.collection.d.ts
Outdated
* @param key The key of the element to add to the Map object. The key may be any JavaScript type (any primitive value or any type of JavaScript object). | ||
* @param value The value of the element to add to the Map object. The value may be any JavaScript type (any primitive value or any type of JavaScript object). |
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.
These comments are not very valuable, but I guess they're OK. In particular, "The key may be any javascript type" is generally true, but untrue for set
, since K
and V
are declared on Map
and will already be instantiated.
I'd vote to remove these lines, but let me know if you want to keep them.
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.
I think almost the same. Most of these are MDN docs with some adjustments to make them easier to read while you are coding. Without the need for going to the docs. But if it makes more sense I would be delighted to adjust
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.
Personally I would delete any JSDoc that essentially just rewrites the code (or other in-scope JSDoc comments) as an English sentence. E.g.
@param key The key of the element to remove from the Map object.
The key
literally just the name of the parameterof the element
I think that’s impliedto remove
just a synonym fordelete
which is the name of the methodfrom the Map
just the name of the typeobject
c'mon 😄
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.
Please remove all the redundant comments based on @andrewbranch 's criterion.
Okay! I've done some adjusts with the jsdocs but I'm still not sure if they are all right especially with these two parts: /**
* Returns a specified element from the Map object. If the value that is associated with the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.
* @param key
* @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
*/
get(key: K): V | undefined; makes sense to have the description and the return part? also, my other question would be if makes sense having jsdocs like this one: /**
* Removes the specified element.
* @param key
*/
delete(key: K): boolean; because the method is already described itself. I'm a little bit confused |
|
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.
A couple straggling @params
but otherwise I think this looks good
src/lib/es2015.collection.d.ts
Outdated
* @param callbackfn | ||
* @param thisArg |
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.
@param
s without a description don’t do anything, I’m pretty sure (same thing on Set
)
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.
Thanks @Grubba27!
Fixes #49472