-
Notifications
You must be signed in to change notification settings - Fork 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
Tighten Closure type annotations. #4997
Conversation
lib/elements/array-selector.html
Outdated
@@ -211,7 +211,7 @@ | |||
|
|||
/** | |||
* Clears the selection state. | |||
* | |||
* @returns {void} |
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.
@return
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.
Done.
lib/elements/dom-bind.html
Outdated
@@ -61,16 +61,19 @@ | |||
this.__children = null; | |||
} | |||
|
|||
// assumes only one observed attribute | |||
/** @returns {void} */ |
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.
@return
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.
Done.
lib/elements/dom-bind.html
Outdated
this.mutableData = true; | ||
} | ||
|
||
/** @returns {void} */ |
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.
@return
is only necessary if the function takes arguments
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.
See below. Think we should keep these.
lib/elements/dom-bind.html
Outdated
connectedCallback() { | ||
this.style.display = 'none'; | ||
this.render(); | ||
} | ||
|
||
/** @returns {void} */ |
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.
@return
is only necessary if the function takes arguments
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 added it because otherwise in TypeScript we have to output returns any
in this case, because we have no idea what the return type is.
lib/elements/dom-module.html
Outdated
@@ -74,6 +74,10 @@ | |||
return null; | |||
} | |||
|
|||
/** | |||
* @param {string} name | |||
* @returns {void} |
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.
@return
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.
Done.
lib/elements/dom-module.html
Outdated
@@ -74,6 +74,10 @@ | |||
return null; | |||
} | |||
|
|||
/** | |||
* @param {string} name |
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.
Add
@param {?string} old
@param {?string} value
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.
Done. Also had to add descriptions according to linter.
lib/legacy/legacy-element-mixin.html
Outdated
@@ -134,6 +134,7 @@ | |||
* @param {string} name Name of attribute. | |||
* @param {?string} old Old value of attribute. | |||
* @param {?string} value Current value of attribute. | |||
* @returns {void} |
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.
@return
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.
Done.
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.
LGTM
I pulled these changes out of #4928. These are various changes to the Polymer core JSDoc annotations that improve the generated TypeScript declarations.
!
non-nullable operators. In Closure, all non-primitive types are non-nullable (we should try to use non-nullable types by default going forward if possible).@private
that are not part of our public API.@return {void}
to some functions that don't return anything.gulp closure
produces no warnings