我現(xiàn)在正在學(xué)習(xí) Microsoft Angular Fundamentals 課程,我發(fā)現(xiàn)他們的示例中缺少分號(hào),例如:gitSearch = (query: string): Promise<GitSearch> => { let promise = new Promise<GitSearch>((resolve, reject) => { if (this.cachedValues[query]) { resolve(this.cachedValues[query]) } else { this.http.get('https://api.github.com/search/repositories?q=' + query) .toPromise() .then( (response) => { resolve(response as GitSearch) }, (error) => { reject(error); }) } }) return promise; }請(qǐng)注意,它們?cè)?之后不使用分號(hào)resolve.thisCachedValues[query])。但是 VS Code'Missing semicolon'在該行給了我 TSLint 警告。如果我省略分號(hào),這是一個(gè)問(wèn)題嗎?
VS Code 強(qiáng)制使用分號(hào),但 Angular TypeScript 示例使用不一致?
慕桂英3389331
2021-09-30 13:41:24