title: Property 'sort' has no initializer and is not definitely assigned in the constructor
body: <p>I am trying to use MatSort Module to sort my Table in Angular Material but I get this error:</p>
  <pre><code>Property 'sort' has no initializer and is not definitely assigned in the constructor.
  </code></pre>
  <p>This is my ts file:</p>
  <pre><code>import { Component, OnInit, ViewChild } from '@angular/core';
  import { Personal } from 'src/app/models/personal.model';
  import { PersonalService } from 'src/app/services/personal.service';
  import { MatTableDataSource } from '@angular/material/table';
  import { MatPaginatorModule } from '@angular/material/paginator'; 
  import { MatSort, MatSortModule, MatSortHeader } from '@angular/material/sort'
  
  @Component({
    selector: 'app-personal-list',
    templateUrl: './personal-list.component.html',
    styleUrls: ['./personal-list.component.css']
  })
  
  export class PersonalListComponent implements OnInit {
    personals?: Personal[];
    currentPersonal?: Personal;
    currentIndex = -1;
    name = '';
  
    PERSONAL_DATA : Personal[] = []
    displayedColumns: string[] = ['name', 'action'];
    dataSource = new MatTableDataSource&lt;Personal&gt;(this.PERSONAL_DATA);
    
    @ViewChild(MatSort) sort: MatSort;
  
    constructor(private personalService: PersonalService) { }
  
    ngOnInit(): void {
      this.getAllPersonalTable();
    }
  
    private getAllPersonalTable(){
      let resp = this.personalService.getAllPersonal();
      resp.subscribe(report =&gt;this.dataSource.data=report as Personal[]);
      this.dataSource.sort = this.sort;
    }
  
  }
  </code></pre>
  <p>The error occurs in this line</p>
  <pre><code>@ViewChild(MatSort) sort: MatSort;
  </code></pre>
  <p>And yes, I have tried <code>sort!</code>. This removes the error, but fails to compile my page. Same goes for <code>&quot;strictPropertyInitialization&quot;: false,</code>in tsconfig.json file.</p>
  <p>Any help on how to solve is much appreciated!!!</p>