打字稿或 angular 语法 methondName(): void{ } 是什么意思? (内码)

What does the typescript or angular syntax methondName(): void{ } mean? (code within)

来自 Angular 英雄之旅教程:https://angular.io/tutorial/toh-pt4

代码:

getHeroes(): void {
  this.heroes = this.heroService.getHeroes();
}

这种声明方法的语法是什么意思?

getHeroes 是方法名

: void which returns void (nothing)

{ 方法体开始

this.heroes = this.heroService.getHeroes(); 方法调用的 return 值 'getHeroes'(来自 heroService)被分配给局部变量 'heroes'

} 方法体结束