Error while building an angular project for Tuple type '[]' of length '0' has no element at index '0'

Viewed 3786

Following is the error when I am executing the following prod command

ng build --prod

ERROR in src/app/inventory/inv-parts-main-table/dialog-component/dialog-component.component.html(5,16): Tuple type '[]' of length '0' has no element at index '0'.

src/app/inventory/inv-parts-main-table/dialog-component/dialog-component.component.html(5,62): Tuple type '[]' of length '0' has no element at index '0'.

src/app/inventory/inv-parts-main-table/dialog-component/dialog-component.component.html(5,62): Tuple type '[]' of length '0' has no element at index '0'.

src/app/inventory/inv-parts-main-table/dialog-component/dialog-component.component.html(9,16): Tuple type '[]' of length '0' has no element at index '1'.

src/app/inventory/inv-parts-main-table/dialog-component/dialog-component.component.html(9,62): Tuple type '[]' of length '0' has no element at index '1'.

src/app/inventory/inv-parts-main-table/dialog-component/dialog-component.component.html(9,62): Tuple type '[]' of length '0' has no element at index '1'.

src/app/inventory/inv-parts-main-table/dialog-component/dialog-component.component.html(13,16): Tuple type '[]' of length '0' has no element at index '2'.

src/app/inventory/inv-parts-main-table/dialog-component/dialog-component.component.html(13,62): Tuple type '[]' of length '0' has no element at index '2'.

src/app/inventory/inv-parts-main-table/dialog-component/dialog-component.component.html(13,62): Tuple type '[]' of length '0' has no element at index '2'.

Source code related to the above error looks like this

<div mat-dialog-content>
    <div style="margin-top: 30pt" *ngIf="data.quote[0]!=null">
      <span><b>{{data.quote[0] | currency}}</b></span> <br />
      {{data.lastUpdatedDate[0] | date :'mediumDate'}} | {{data.supplierName[0]}}
    </div>
    <div style="margin-top: 10pt" *ngIf="data.quote[1]!=null">
      <span><b>{{data.quote[1] | currency}}</b></span> <br />
      {{data.lastUpdatedDate[1] | date :'mediumDate'}} | {{data.supplierName[1]}}
    </div>
    <div style="margin-top: 10pt" *ngIf="data.quote[2]!=null">
      <span><b>{{data.quote[2] | currency}}</b></span> <br />
      {{data.lastUpdatedDate[2] | date :'mediumDate'}} | {{data.supplierName[2]}}
    </div>
</div>

The Ts file looks like below

export interface DialogData {
  quote: [];
  lastUpdatedDate : [];
  supplierName: [];
}
1 Answers

Following ts change helped me to fix this issue

Tuple type '[]' of length '0' has no element at index '1'.

export interface DialogData {
  quote: string[];
  lastUpdatedDate : string[];
  supplierName: string[];
}
Related