From 11900eae9681936f018ee6eca593e21c7f5a3c0d Mon Sep 17 00:00:00 2001 From: Max Okorokov Date: Fri, 3 Jan 2020 14:03:58 +0100 Subject: [PATCH] revert: fix(modal): add typing for `modalRef.componentInstance` (#2815) This reverts commit f450a7c9 Fixes #3464 --- src/modal/modal-ref.ts | 4 ++-- src/modal/modal.spec.ts | 2 +- src/modal/modal.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modal/modal-ref.ts b/src/modal/modal-ref.ts index 2477d8ef11..094a05b6c7 100644 --- a/src/modal/modal-ref.ts +++ b/src/modal/modal-ref.ts @@ -30,7 +30,7 @@ export class NgbActiveModal { /** * A reference to the newly opened modal returned by the `NgbModal.open()` method. */ -export class NgbModalRef { +export class NgbModalRef { private _resolve: (result?: any) => void; private _reject: (reason?: any) => void; @@ -39,7 +39,7 @@ export class NgbModalRef { * * When a `TemplateRef` is used as the content or when the modal is closed, will return `undefined`. */ - get componentInstance(): T extends new (...args: any[]) => any? InstanceType: undefined { + get componentInstance(): any { if (this._contentRef && this._contentRef.componentRef) { return this._contentRef.componentRef.instance; } diff --git a/src/modal/modal.spec.ts b/src/modal/modal.spec.ts index dbe9ab50a6..08ff227118 100644 --- a/src/modal/modal.spec.ts +++ b/src/modal/modal.spec.ts @@ -886,7 +886,7 @@ export class WithSkipTabindexFirstFocusableModalCmpt { }) class TestComponent { name = 'World'; - openedModal: NgbModalRef; + openedModal: NgbModalRef; show = true; @ViewChild('content', {static: true}) tplContent; @ViewChild('destroyableContent', {static: true}) tplDestroyableContent; diff --git a/src/modal/modal.ts b/src/modal/modal.ts index 6f438b3cd9..38e832d0a7 100644 --- a/src/modal/modal.ts +++ b/src/modal/modal.ts @@ -25,7 +25,7 @@ export class NgbModal { * * Also see the [`NgbModalOptions`](#/components/modal/api#NgbModalOptions) for the list of supported options. */ - open(content: T, options: NgbModalOptions = {}): NgbModalRef { + open(content: any, options: NgbModalOptions = {}): NgbModalRef { const combinedOptions = Object.assign({}, this._config, options); return this._modalStack.open(this._moduleCFR, this._injector, content, combinedOptions); }