Improve Readability by Annotating Types with JSDoc

Tomasz Ducin
InstructorTomasz Ducin
Share this video with your friends

Social Share Links

Send Tweet
Published 6 months ago
Updated 2 months ago

JSDoc allows you to add more context to what is displayed to your type when you hover over a value in your editor. We'll go over a basic use case of adding comments to our Type Alias so those will appear when we hover over them.

[00:00] When creating type aliases provide the JS doc annotations briefly defining what is the purpose of this type. In our case, the money type is intended only for money related values and the skill type represents an employee skill. Whenever anyone hovers over [00:19] the type, they will see the type's relevant information. This can include links to tasks and documentation, but it can also be information about relations to other types used within the system. Of course, providing JsDoc could be useful in many other situations.