Skip to content

Commit

Permalink
fix(module:modal): fix generic type of the "nzComponentParams" for us…
Browse files Browse the repository at this point in the history
…er to gain more type intellisense (#1812)
  • Loading branch information
wilsoncook authored and Jason committed Sep 7, 2018
1 parent 98cb651 commit 6ef1185
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions components/modal/nz-modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -50,14 +46,14 @@ type AnimationState = 'enter' | 'leave' | null;
})

// tslint:disable-next-line:no-any
export class NzModalComponent<T = any, R = any> extends NzModalRef<T, R> implements OnInit, OnChanges, AfterViewInit, OnDestroy, ModalOptions {
export class NzModalComponent<T = any, R = any> extends NzModalRef<T, R> implements OnInit, OnChanges, AfterViewInit, OnDestroy, ModalOptions<T> {
private unsubscribe$ = new Subject<void>();

// tslint:disable-next-line:no-any
locale: any = {};
@Input() nzModalType: ModalType = 'default';
@Input() nzContent: string | TemplateRef<{}> | Type<T>; // [STATIC] If not specified, will use <ng-content>
@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<ModalButtonOptions<T>>; // [STATIC] Default Modal ONLY
@Input() nzGetContainer: HTMLElement | OverlayRef | (() => HTMLElement | OverlayRef) = () => this.overlay.create(); // [STATIC]

Expand Down
2 changes: 1 addition & 1 deletion components/modal/nz-modal.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface ModalOptions<T = any, R = any> { // tslint:disable-line:no-any
nzIconType?: string; // Confirm Modal ONLY
nzTitle?: string | TemplateRef<{}>;
nzContent?: string | TemplateRef<{}> | Type<T>;
nzComponentParams?: object;
nzComponentParams?: Partial<T>;
nzClosable?: boolean;
nzMask?: boolean;
nzMaskClosable?: boolean;
Expand Down

0 comments on commit 6ef1185

Please sign in to comment.