@@ -921,7 +921,7 @@ export class FlexibleConnectedPositionStrategy implements PositionStrategy {
921
921
scrollPosition : ViewportScrollPosition ) {
922
922
// Reset any existing styles. This is necessary in case the
923
923
// 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 ;
925
925
let overlayPoint = this . _getOverlayPoint ( originPoint , this . _overlayRect , position ) ;
926
926
927
927
if ( this . _isPushed ) {
@@ -957,7 +957,7 @@ export class FlexibleConnectedPositionStrategy implements PositionStrategy {
957
957
scrollPosition : ViewportScrollPosition ) {
958
958
// Reset any existing styles. This is necessary in case the preferred position has
959
959
// changed since the last `apply`.
960
- let styles = { left : null , right : null } as CSSStyleDeclaration ;
960
+ let styles = { left : null , right : null } as NullableCSSStyleDeclaration ;
961
961
let overlayPoint = this . _getOverlayPoint ( originPoint , this . _overlayRect , position ) ;
962
962
963
963
if ( this . _isPushed ) {
@@ -1174,6 +1174,15 @@ interface FlexibleFit {
1174
1174
boundingBoxRect : BoundingBoxRect ;
1175
1175
}
1176
1176
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
+
1177
1186
/** A connected position as specified by the user. */
1178
1187
export interface ConnectedPosition {
1179
1188
originX : 'start' | 'center' | 'end' ;
@@ -1189,12 +1198,13 @@ export interface ConnectedPosition {
1189
1198
}
1190
1199
1191
1200
/** 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 {
1193
1203
for ( let key in source ) {
1194
1204
if ( source . hasOwnProperty ( key ) ) {
1195
- dest [ key ] = source [ key ] ;
1205
+ destination [ key ] = source [ key ] ;
1196
1206
}
1197
1207
}
1198
1208
1199
- return dest ;
1209
+ return destination ;
1200
1210
}
0 commit comments