Merge pull request #5650 from Polymer/attribute-override-types

Fix TypeScript breakages by specifying types for overridden `setAttribute` and `getAttribute`.
This commit is contained in:
Russell Bicknell
2020-04-27 20:37:37 -07:00
committed by GitHub

View File

@@ -143,7 +143,12 @@ export const LegacyElementMixin = dedupingMixin((base) => {
} }
} }
/** @override */ /**
* Sets the value of an attribute.
* @override
* @param {string} name The name of the attribute to change.
* @param {string} value The new attribute value.
*/
setAttribute(name, value) { setAttribute(name, value) {
if (legacyNoObservedAttributes && !this._legacyForceObservedAttributes) { if (legacyNoObservedAttributes && !this._legacyForceObservedAttributes) {
const oldValue = this.getAttribute(name); const oldValue = this.getAttribute(name);
@@ -155,7 +160,11 @@ export const LegacyElementMixin = dedupingMixin((base) => {
} }
} }
/** @override */ /**
* Removes an attribute.
* @override
* @param {string} name The name of the attribute to remove.
*/
removeAttribute(name) { removeAttribute(name) {
if (legacyNoObservedAttributes && !this._legacyForceObservedAttributes) { if (legacyNoObservedAttributes && !this._legacyForceObservedAttributes) {
const oldValue = this.getAttribute(name); const oldValue = this.getAttribute(name);