VS Code enforces semicolons but why doesn t Angular and TypeScript not use it consistently

0 votes

I'm taking the Microsoft Angular Fundamentals course right now and I spotted lack of semicolons in their examples, something like:

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;
  }

Notice they don't use semicolons after resolve.thisCachedValues[query]). But VS Code gives me TSLint warning 'Missing semicolon' at that line. Is this an issue if I omit the semicolon?

May 31 in TypeSript by Logan
• 2,140 points
44 views

1 answer to this question.

0 votes

JavaScript has a syntactic feature known as semicolon insertion. Since Typescript is a strict superset of JavaScript, semicolon insertion applies to Typescript as well. This means that in most cases, semicolons are not required. You can refer the documentations for more information.

answered May 31 by Nina
• 3,020 points

Related Questions In TypeSript

0 votes
0 answers
0 votes
0 answers

What is TypeScript and why would I use it in place of JavaScript?

Can you please describe what the TypeScript ...READ MORE

Jul 18 in TypeSript by Logan
• 2,140 points
8 views
0 votes
1 answer

The Angular Compiler requires TypeScript >=3.4.0 and <3.5.0 but 3.5.3 was found instead

Run this script to find exact version npm ...READ MORE

answered 5 days ago in TypeSript by Abhinaya
• 760 points
9 views
0 votes
1 answer

How to set meta tags using Angular universal SSR and ngx-seo plug-in?

first Install the plug-in with npm i ngx-seo ...READ MORE

answered Feb 11 in Others by narikkadan
• 11,280 points
688 views
0 votes
0 answers

Can't bind to 'ngModel' since it isn't a known property of 'input'

I have this  input in my component ...READ MORE

Apr 29 in Other DevOps Questions by Kichu
• 19,040 points
140 views
0 votes
1 answer

Square brackets around vs after expression in Typescript

x is an Array, while y is a Tuple. The ...READ MORE

answered Jun 7 in TypeSript by Nina
• 3,020 points
112 views
0 votes
1 answer

What does the @ (at sign) sign do in TypeScript?

The big news this week is the ...READ MORE

answered Jun 10 in TypeSript by Nina
• 3,020 points
20 views
0 votes
1 answer

What is TypeScript and why would I use it in place of JavaScript?

TypeScript is a superset of JavaScript which primarily ...READ MORE

answered May 31 in TypeSript by Nina
• 3,020 points
10 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP