Skip to content

Commit 62d37ac

Browse files
authored
refactor: remove any type from ts4.4 upgrade regarding (#23671)
Removes the `any` type used in the previous ts4.4 upgrade PR when refering to the style property on the element. Creates a new type to work around the built in `CSSStyleDeclaration` not including `webkitTapHighlightColor`.
1 parent 335a798 commit 62d37ac

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/cdk/drag-drop/drag-ref.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {DropListRefInternal as DropListRef} from './drop-list-ref';
2121
import {DragDropRegistry} from './drag-drop-registry';
2222
import {
2323
combineTransforms,
24+
DragCSSStyleDeclaration,
2425
extendStyles,
2526
toggleNativeDragInteractions,
2627
toggleVisibility,
@@ -747,7 +748,8 @@ export class DragRef<T = any> {
747748
this._toggleNativeDragInteractions();
748749

749750
if (this._handles) {
750-
(this._rootElement.style as any).webkitTapHighlightColor = this._rootElementTapHighlight;
751+
(this._rootElement.style as DragCSSStyleDeclaration).webkitTapHighlightColor =
752+
this._rootElementTapHighlight;
751753
}
752754

753755
if (!this._hasStartedDragging) {
@@ -878,7 +880,7 @@ export class DragRef<T = any> {
878880
// otherwise iOS will still add it, even though all the drag interactions on the handle
879881
// are disabled.
880882
if (this._handles.length) {
881-
const rootStyles = rootElement.style as any;
883+
const rootStyles = rootElement.style as DragCSSStyleDeclaration;
882884
this._rootElementTapHighlight = rootStyles.webkitTapHighlightColor || '';
883885
rootStyles.webkitTapHighlightColor = 'transparent';
884886
}

src/cdk/drag-drop/drag-styling.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
export interface DragCSSStyleDeclaration extends CSSStyleDeclaration {
1414
msScrollSnapType: string;
1515
scrollSnapType: string;
16+
webkitTapHighlightColor: string;
1617
}
1718

1819
/**

0 commit comments

Comments
 (0)