所以我遇到了网络,我想知道在Typescript中隐含的是什么?
就像这里一样:
private _handleProjectQuerySuccess(data: IProject[]): void { data.sort(this._projectSort); var pathname = this._$location.path(); var activeSet = false; data.forEach((project: IProject) => { project.active = pathname == '/' + project.id; activeSet = activeSet || project.active; project.name = this._$sanitize(project.name); project.description = this._$sanitize(project.description); project.url = this._$sce.trustAsUrl(project.url); project.readme = this._$sce.trustAsHtml(project.readme); project.title = project.name + (project.fork ? ' (fork)' : ' (repo)'); this._scope.projects.push(project); this._projectMap[project.id] = this._scope.projects[this._scope.projects.length - 1]; }); if (!activeSet) { data[0].active = true; } }
在我们宣布私有之后,我们暗示无效……这是什么意思?
解决方法
这只是一种类型,如下所示:
Perhaps the opposite in some ways to ‘any’ is ‘void’,the absence of having any type at all. You may commonly see this as the return type of functions that do not return a value:
function warnUser(): void { alert("This is my warning message"); }