Skip to content

Commit

Permalink
build: fix some TS build issues in templates
Browse files Browse the repository at this point in the history
Fixes _some_ of the issues found when ng-zorro is used in projects with TS strict mode, mostly in HTML templates.

Partially addresses #660, but still a long way to go.
  • Loading branch information
Merott committed Dec 2, 2018
1 parent 9fee376 commit 696a6c4
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 7 deletions.
3 changes: 3 additions & 0 deletions components/message/nz-message-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export interface NzMessageConfig {
nzAnimate?: boolean;
// For message container only
nzMaxStack?: number;
nzTop?: string;
nzBottom?: string;
nzPlacement?: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | string;
/* tslint:disable-next-line:no-any */
[index: string]: any;
}
Expand Down
4 changes: 2 additions & 2 deletions components/notification/nz-notification.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="ant-notification-notice ant-notification-notice-closable"
[ngStyle]="nzMessage.options.nzStyle"
[ngClass]="nzMessage.options.nzClass"
[ngStyle]="nzMessage.options?.nzStyle"
[ngClass]="nzMessage.options?.nzClass"
[@enterLeave]="state"
(mouseenter)="onEnter()"
(mouseleave)="onLeave()">
Expand Down
4 changes: 2 additions & 2 deletions components/pagination/nz-pagination.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class NzPaginationComponent implements OnInit, OnDestroy {
private _total: number;
private _pageIndex = 1;
firstIndex = 1;
pages = [];
pages: Array<{index: number}> = [];
@Input() nzShowTotal: TemplateRef<{ $implicit: number, range: [ number, number ] }>;
@Input() nzInTable = false;
@Input() nzSize: string;
Expand Down Expand Up @@ -231,7 +231,7 @@ export class NzPaginationComponent implements OnInit, OnDestroy {

/** generate indexes list */
buildIndexes(): void {
const tmpPages = [];
const tmpPages: Array<{index: number}> = [];
if (this.lastIndex <= 9) {
for (let i = 2; i <= this.lastIndex - 1; i++) {
tmpPages.push({ index: i });
Expand Down
2 changes: 1 addition & 1 deletion components/table/nz-td.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
(ngModelChange)="nzCheckedChange.emit($event)">
</label>
<span
*ngIf="!nzShowExpand && nzIndentSize != null"
*ngIf="!nzShowExpand && nzIndentSize >= 0"
class="ant-table-row-expand-icon ant-table-row-spaced"></span>
<span
*ngIf="nzShowExpand"
Expand Down
2 changes: 1 addition & 1 deletion components/table/nz-th.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class NzThComponent {
singleFilterList: NzThItemInterface[] = [];
@ViewChild(NzDropDownComponent) nzDropDownComponent: NzDropDownComponent;
/* tslint:disable-next-line:no-any */
@Input() nzSelections: Array<{ text: string, onSelect: any }> = [];
@Input() nzSelections: Array<{ text: string, onSelect(): any }> = [];
@Input() nzChecked = false;
@Input() nzDisabled = false;
@Input() nzIndeterminate = false;
Expand Down
2 changes: 1 addition & 1 deletion components/tabs/nz-tabset.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#tabContent
[class.ant-tabs-content-animated]="tabPaneAnimated"
[class.ant-tabs-content-no-animated]="!tabPaneAnimated"
[style.margin-left.%]="tabPaneAnimated&&(-nzSelectedIndex*100)">
[style.margin-left.%]="tabPaneAnimated&&(-(nzSelectedIndex || 0)*100)">
<div nz-tab-body
class="ant-tabs-tabpane"
[class.ant-tabs-tabpane-active]="(nzSelectedIndex == i) && !nzHideAll"
Expand Down
1 change: 1 addition & 0 deletions components/upload/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface UploadFile {
uid: string;
size: number;
name: string;
message?: string;
filename?: string;
lastModified?: string;
lastModifiedDate?: Date;
Expand Down

0 comments on commit 696a6c4

Please sign in to comment.