You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import { Component, OnInit, AfterViewInit,} from '@angular/core';
import { MatTableDataSource } from '@angular/material';
import { Data } from 'src/app/core/data/data.model';
import { DataService } from 'src/app/core/data/data.service';
@Component({
selector: 'app-mycomponent,
templateUrl: './mycomponent.html',
styleUrls: ['./mycomponent.css']
})
export class MyComponent implements OnInit, AfterViewInit {
dataSource = new Array<MatTableDataSource<Data['Column']>>();
constructor(private ds: DataService) {
}
ngOnInit() {
}
ngAfterViewInit(): void {
this.loadData();
}
loadData(): void {
this.ds.getData().subscribe(data=> {
if (data=== null) { return; }
this.dataSource[0] = new MatTableDataSource(data as []);
});
}
Expected behavior:
Should not throwing ERROR in console Actual behavior:
First compile after build doesn't work and throwing error TS1122: A tuple type element list cannot be empty. in line with this.dataSource[0] = new MatTableDataSource(data as []). After enter some changes in code to trigger recompilation my application works, but still throwing error.
TypeScript Version: 3.01
Search Terms:
#16636
Code
mycomponent.ts
Expected behavior:
Should not throwing ERROR in console
Actual behavior:
First compile after build doesn't work and throwing error TS1122: A tuple type element list cannot be empty. in line with this.dataSource[0] = new MatTableDataSource(data as []). After enter some changes in code to trigger recompilation my application works, but still throwing error.
Related Issues:
#7520
The text was updated successfully, but these errors were encountered: