Skip to content

Commit 604856b

Browse files
committed
Update Closure types for overridden setAttribute in LegacyElementMixin.
1 parent 05878b6 commit 604856b

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

gen-tsd.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"index.html"
99
],
1010
"excludeIdentifiers": [
11-
"templatizedBase"
11+
"templatizedBase",
12+
"setAttribute"
1213
],
1314
"removeReferences": [
1415
"../shadycss/apply-shim.d.ts",

lib/legacy/legacy-element-mixin.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,15 @@ export const LegacyElementMixin = dedupingMixin((base) => {
145145

146146
/**
147147
* Sets the value of an attribute.
148+
*
149+
* NOTE: This function is explicitly excluded when running
150+
* gen-typescript-declarations because the function it overrides has
151+
* different signatures in Closure and TypeScript's built-in types. This
152+
* function's signature should match the signature from Closure:
153+
* https://github.com/google/closure-compiler/blob/8972fd4e9b0689e7ebdeea53580521c819f6aecc/externs/browser/w3c_dom1.js#L686-L694
148154
* @override
149155
* @param {string} name The name of the attribute to change.
150-
* @param {string} value The new attribute value.
156+
* @param {string|number|boolean|!TrustedHTML|!TrustedScriptURL|!TrustedURL} value The new attribute value.
151157
*/
152158
setAttribute(name, value) {
153159
if (legacyNoObservedAttributes && !this._legacyForceObservedAttributes) {

0 commit comments

Comments
 (0)