Skip to content

Commit ef21b82

Browse files
authored
refactor(cdk/drag-drop): remove unnecessary type (#29541)
Removes the `RootNode` internal type since it isn't necessary anymore.
1 parent 7370eb9 commit ef21b82

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

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

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ enum AutoScrollHorizontalDirection {
4949
RIGHT,
5050
}
5151

52-
type RootNode = DocumentOrShadowRoot & {
53-
// As of TS 4.4 the built in DOM typings don't include `elementFromPoint` on `ShadowRoot`,
54-
// even though it exists (see https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot).
55-
// This type is a utility to avoid having to add casts everywhere.
56-
elementFromPoint(x: number, y: number): Element | null;
57-
};
58-
5952
/**
6053
* Reference to a drop list. Used to manipulate or dispose of the container.
6154
*/
@@ -181,7 +174,7 @@ export class DropListRef<T = any> {
181174
private readonly _stopScrollTimers = new Subject<void>();
182175

183176
/** Shadow root of the current element. Necessary for `elementFromPoint` to resolve correctly. */
184-
private _cachedShadowRoot: RootNode | null = null;
177+
private _cachedShadowRoot: DocumentOrShadowRoot | null = null;
185178

186179
/** Reference to the document. */
187180
private _document: Document;
@@ -760,10 +753,10 @@ export class DropListRef<T = any> {
760753
* in order to ensure that the element has been moved into the shadow DOM. Doing it inside the
761754
* constructor might be too early if the element is inside of something like `ngFor` or `ngIf`.
762755
*/
763-
private _getShadowRoot(): RootNode {
756+
private _getShadowRoot(): DocumentOrShadowRoot {
764757
if (!this._cachedShadowRoot) {
765758
const shadowRoot = _getShadowRoot(this._container);
766-
this._cachedShadowRoot = (shadowRoot || this._document) as RootNode;
759+
this._cachedShadowRoot = shadowRoot || this._document;
767760
}
768761

769762
return this._cachedShadowRoot;

0 commit comments

Comments
 (0)