From 6ef11859c4711726260b1ddeb88a6efe4d5d18ef Mon Sep 17 00:00:00 2001 From: Wilson Zeng Date: Fri, 7 Sep 2018 19:34:58 +0800 Subject: [PATCH] fix(module:modal): fix generic type of the "nzComponentParams" for user to gain more type intellisense (#1812) --- components/modal/nz-modal.component.ts | 8 ++------ components/modal/nz-modal.type.ts | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/components/modal/nz-modal.component.ts b/components/modal/nz-modal.component.ts index 6fa8474ded2..4abd877d31e 100644 --- a/components/modal/nz-modal.component.ts +++ b/components/modal/nz-modal.component.ts @@ -38,10 +38,6 @@ import { ModalButtonOptions, ModalOptions, ModalType, OnClickCallback } from './ export const MODAL_ANIMATE_DURATION = 200; // Duration when perform animations (ms) -interface ClassMap { - [ index: string ]: boolean; -} - type AnimationState = 'enter' | 'leave' | null; @Component({ @@ -50,14 +46,14 @@ type AnimationState = 'enter' | 'leave' | null; }) // tslint:disable-next-line:no-any -export class NzModalComponent extends NzModalRef implements OnInit, OnChanges, AfterViewInit, OnDestroy, ModalOptions { +export class NzModalComponent extends NzModalRef implements OnInit, OnChanges, AfterViewInit, OnDestroy, ModalOptions { private unsubscribe$ = new Subject(); // tslint:disable-next-line:no-any locale: any = {}; @Input() nzModalType: ModalType = 'default'; @Input() nzContent: string | TemplateRef<{}> | Type; // [STATIC] If not specified, will use - @Input() nzComponentParams: object; // [STATIC] ONLY avaliable when nzContent is a component + @Input() nzComponentParams: T; // [STATIC] ONLY avaliable when nzContent is a component @Input() nzFooter: string | TemplateRef<{}> | Array>; // [STATIC] Default Modal ONLY @Input() nzGetContainer: HTMLElement | OverlayRef | (() => HTMLElement | OverlayRef) = () => this.overlay.create(); // [STATIC] diff --git a/components/modal/nz-modal.type.ts b/components/modal/nz-modal.type.ts index 5d4c72b270c..42e73ed63c6 100644 --- a/components/modal/nz-modal.type.ts +++ b/components/modal/nz-modal.type.ts @@ -19,7 +19,7 @@ export interface ModalOptions { // tslint:disable-line:no-any nzIconType?: string; // Confirm Modal ONLY nzTitle?: string | TemplateRef<{}>; nzContent?: string | TemplateRef<{}> | Type; - nzComponentParams?: object; + nzComponentParams?: Partial; nzClosable?: boolean; nzMask?: boolean; nzMaskClosable?: boolean;