Skip to content

Commit 0d1395f

Browse files
committed
refactor: remove any type from ts4.4 upgrade regarding
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 7c16258 commit 0d1395f

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
@@ -24,6 +24,7 @@ import {DropListRefInternal as DropListRef} from './drop-list-ref';
2424
import {DragDropRegistry} from './drag-drop-registry';
2525
import {
2626
combineTransforms,
27+
DragCSSStyleDeclaration,
2728
extendStyles,
2829
toggleNativeDragInteractions,
2930
toggleVisibility,
@@ -756,7 +757,8 @@ export class DragRef<T = any> {
756757
this._toggleNativeDragInteractions();
757758

758759
if (this._handles) {
759-
(this._rootElement.style as any).webkitTapHighlightColor = this._rootElementTapHighlight;
760+
(this._rootElement.style as DragCSSStyleDeclaration).webkitTapHighlightColor =
761+
this._rootElementTapHighlight;
760762
}
761763

762764
if (!this._hasStartedDragging) {
@@ -884,7 +886,7 @@ export class DragRef<T = any> {
884886
// otherwise iOS will still add it, even though all the drag interactions on the handle
885887
// are disabled.
886888
if (this._handles.length) {
887-
const rootStyles = rootElement.style as any;
889+
const rootStyles = rootElement.style as DragCSSStyleDeclaration;
888890
this._rootElementTapHighlight = rootStyles.webkitTapHighlightColor || '';
889891
rootStyles.webkitTapHighlightColor = 'transparent';
890892
}

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)