向数组中添加数据但length打印为0

向数组中push了数据, 但是打印的时候为[]数组,但是空数组里面有数据,length为5, 但是打印出来length发现长度为0,这个怎么弄啊?急求?

types: any[] = [];

  constructor(
    private router: Router,
    private typeSrv: TypeService,
    private arraySrv: ArrayService
  ) {
    this.load();
  }


  ngOnInit() {
    console.log(this.types)
  }
  load(): any {
   this.typeSrv.listType()
    .pipe(map(res => res.data))
    .subscribe(res => {
      const typeTree = this.arraySrv.arrToTree(res);
      const typeEnum = this.convert(typeTree);
      for(const i of typeEnum) {
        this.types.push(i);
      }
    })
  }