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 NG-ZORRO#660, but still a long way to go.
  • Loading branch information
Merott committed Dec 28, 2018
1 parent 6554cf5 commit 156b876
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { NzNotificationDataFilled } from './nz-notification.definitions';
templateUrl : './nz-notification-container.component.html'
})
export class NzNotificationContainerComponent extends NzMessageContainerComponent {
config: NzNotificationConfig = {};

constructor(
cdr: ChangeDetectorRef,
@Optional() @Inject(NZ_NOTIFICATION_DEFAULT_CONFIG) defaultConfig: NzNotificationConfig,
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 @@ -39,7 +39,7 @@
[class.ant-tabs-right-content]="nzTabPosition === 'right'"
[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"
*ngFor="let tab of listOfNzTabComponent; let i = index"
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 156b876

Please sign in to comment.