@@ -921,7 +921,7 @@ export class FlexibleConnectedPositionStrategy implements PositionStrategy {
921921 scrollPosition : ViewportScrollPosition ) {
922922 // Reset any existing styles. This is necessary in case the
923923 // preferred position has changed since the last `apply`.
924- let styles = { top : null , bottom : null } as CSSStyleDeclaration ;
924+ let styles = { top : null , bottom : null } as NullableCSSStyleDeclaration ;
925925 let overlayPoint = this . _getOverlayPoint ( originPoint , this . _overlayRect , position ) ;
926926
927927 if ( this . _isPushed ) {
@@ -957,7 +957,7 @@ export class FlexibleConnectedPositionStrategy implements PositionStrategy {
957957 scrollPosition : ViewportScrollPosition ) {
958958 // Reset any existing styles. This is necessary in case the preferred position has
959959 // changed since the last `apply`.
960- let styles = { left : null , right : null } as CSSStyleDeclaration ;
960+ let styles = { left : null , right : null } as NullableCSSStyleDeclaration ;
961961 let overlayPoint = this . _getOverlayPoint ( originPoint , this . _overlayRect , position ) ;
962962
963963 if ( this . _isPushed ) {
@@ -1174,6 +1174,15 @@ interface FlexibleFit {
11741174 boundingBoxRect : BoundingBoxRect ;
11751175}
11761176
1177+ /**
1178+ * Equivalent of CSSStyleDeclaration, but allows for `null` values. We need to do
1179+ * this while we support TS 3.6 and 3.7 since the built-in types are different.
1180+ * TODO(crisbeto): we can switch back to the regular CSSStyleDeclaration once we're running TS 3.7.
1181+ */
1182+ type NullableCSSStyleDeclaration = {
1183+ [ T in keyof CSSStyleDeclaration ] : CSSStyleDeclaration [ T ] | null ;
1184+ } ;
1185+
11771186/** A connected position as specified by the user. */
11781187export interface ConnectedPosition {
11791188 originX : 'start' | 'center' | 'end' ;
@@ -1189,12 +1198,13 @@ export interface ConnectedPosition {
11891198}
11901199
11911200/** Shallow-extends a stylesheet object with another stylesheet object. */
1192- function extendStyles ( dest : CSSStyleDeclaration , source : CSSStyleDeclaration ) : CSSStyleDeclaration {
1201+ function extendStyles ( destination : NullableCSSStyleDeclaration ,
1202+ source : NullableCSSStyleDeclaration ) : NullableCSSStyleDeclaration {
11931203 for ( let key in source ) {
11941204 if ( source . hasOwnProperty ( key ) ) {
1195- dest [ key ] = source [ key ] ;
1205+ destination [ key ] = source [ key ] ;
11961206 }
11971207 }
11981208
1199- return dest ;
1209+ return destination ;
12001210}
0 commit comments