TypeScript's Comments are like JavaScript's with One Exception
This lesson discusses the common and simplest way to comment in TypeScript.
Comments give more information about the variables or functions in our code.
Comments in TypeScript use the same syntax as JavaScript. So, you can use the double slash for single-line comments or use slash stars to open a block of comments and a star slash to close the block. A use of slash star /*
is for JSDoc style or to comment on a big block of comments. You can cause TypeScript to not emit any comments using the compiler option removeComments
.
Get hands-on with 1200+ tech skills courses.