From c19e4527f4f80af3e5a1f4d39fcebaa48ece9eec Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Fri, 13 Mar 2020 17:47:03 -0700 Subject: [PATCH 1/2] Add extra type information to help closure with type of static property. --- src/lib/updating-element.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/updating-element.ts b/src/lib/updating-element.ts index 4912dab1..876e2b3a 100644 --- a/src/lib/updating-element.ts +++ b/src/lib/updating-element.ts @@ -627,7 +627,9 @@ export abstract class UpdatingElement extends HTMLElement { return; } const ctor = (this.constructor as typeof UpdatingElement); - const propName = ctor._attributeToPropertyMap.get(name); + // Note, hint this as an `AttributeMap` so closure clearly understands + // the type; it has issues with tracking types through statics + const propName = (ctor._attributeToPropertyMap as AttributeMap).get(name); if (propName !== undefined) { const options = ctor.getPropertyOptions(propName); // mark state reflecting From eb286a257288aa4852ac6945539f75b3a43f75eb Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Fri, 13 Mar 2020 17:58:03 -0700 Subject: [PATCH 2/2] Add tslint:disable for "unnecessary" type assertion necessary for closure. --- src/lib/updating-element.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/updating-element.ts b/src/lib/updating-element.ts index 876e2b3a..846af573 100644 --- a/src/lib/updating-element.ts +++ b/src/lib/updating-element.ts @@ -629,6 +629,7 @@ export abstract class UpdatingElement extends HTMLElement { const ctor = (this.constructor as typeof UpdatingElement); // Note, hint this as an `AttributeMap` so closure clearly understands // the type; it has issues with tracking types through statics + // tslint:disable-next-line:no-unnecessary-type-assertion const propName = (ctor._attributeToPropertyMap as AttributeMap).get(name); if (propName !== undefined) { const options = ctor.getPropertyOptions(propName);