From 09f05ec41f7465cceb45576ce019b4e15fb20938 Mon Sep 17 00:00:00 2001 From: Achilles1515 Date: Fri, 9 Oct 2020 09:00:45 -0400 Subject: [PATCH] refactor(cdk/drag-drop): Correctly type drag handle parent drag without circular dependencies warning Import the `CdkDrag` directive reference as a type-only import to avoid the circular dependency warning. --- src/cdk/drag-drop/directives/drag-handle.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cdk/drag-drop/directives/drag-handle.ts b/src/cdk/drag-drop/directives/drag-handle.ts index 0cf5223ba97e..a5ac6516a46c 100644 --- a/src/cdk/drag-drop/directives/drag-handle.ts +++ b/src/cdk/drag-drop/directives/drag-handle.ts @@ -18,6 +18,7 @@ import { SkipSelf, } from '@angular/core'; import {Subject} from 'rxjs'; +import type {CdkDrag} from './drag'; import {CDK_DRAG_PARENT} from '../drag-parent'; import {assertElementNode} from './assertions'; @@ -38,7 +39,7 @@ export const CDK_DRAG_HANDLE = new InjectionToken('CdkDragHandle' }) export class CdkDragHandle implements OnDestroy { /** Closest parent draggable instance. */ - _parentDrag: {} | undefined; + _parentDrag: CdkDrag | undefined; /** Emits when the state of the handle has changed. */ readonly _stateChanges = new Subject(); @@ -56,7 +57,7 @@ export class CdkDragHandle implements OnDestroy { constructor( public element: ElementRef, - @Inject(CDK_DRAG_PARENT) @Optional() @SkipSelf() parentDrag?: any, + @Inject(CDK_DRAG_PARENT) @Optional() @SkipSelf() parentDrag?: CdkDrag, ) { if (typeof ngDevMode === 'undefined' || ngDevMode) { assertElementNode(element.nativeElement, 'cdkDragHandle');