• Home
  • Today I learned
  • We can use JSDocs to have a visual indication on VSCode something is deprecated

We can use JSDocs to have a visual indication on VSCode something is deprecated

This article was published on Jan 25, 2021, and takes less than a minute to read.

When we decorate a function variable, class or anything with @deprecated. By doing that, VSCode will understand and show it with a strikethrough style:

/**
 * @deprecated This method is deprecated. Please `render` instead
 */
function oldRender(){}

function render(){}

const TestLib = {
  oldRender,
  render
};

TestLib.oldRender(); // <strikethrough and deprecate message

And it looks like this:

@deprecated style
@deprecated style

Resources