microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.22k stars 12.52k forks source link

`@experimental` JSDoc tag, with strikethrough style (or similar) like `@deprecated` JSDoc tag #56808

Open trusktr opened 11 months ago

trusktr commented 11 months ago

πŸ” Search Terms

experimental jsdoc tag

βœ… Viability Checklist

⭐ Suggestion

I would like to mark some new APIs as "experimental" with an @experimental JSDoc tag, and have people's IDE's show a visual hint (like how @deprecated styles text with strike-through)

πŸ“ƒ Motivating Example

There's no way (unless I missed it) to introduce an experimental feature and to have that reflected in IDEs like @deprecated does. Example:

/**
 * @experimental Not ready for production. This feature is slated to land in the next minor. Early feedback welcome!  
 */
export function doSomethingNewAndCool() {
  // ...
}

and then IDEs would highlight this in a certain way in the code, for example like how @deprecated styles text with a strike through.

/**
 * @deprecated Not ready for production. This feature is slated to land in the next minor and be un-deprecated. Early feedback welcome!  
 */
export function doSomethingNewAndCool() {
  // ...
}
Screenshot 2023-12-16 at 5 28 49β€―PM

πŸ’» Use Cases

See motivating example.

For now, a workaround is to use @deprecated, then clearly denote that the feature will be un-deprecated in a following release, but some people might misinterpret that or not read the whole message:

danhorvath commented 8 months ago

We use the @experimental tag to mark certain components and features in our internal design system. Currently we use a custom linter rule to help our consumers notice when they use an experimental component/feature, but we would very much appreciate an explicit visual hint in the IDE

nikeee commented 8 months ago

If this is up for grabs, I'd implement that

lppedd commented 1 month ago

This is extremely useful, especially when the codebase is in prototyping phase.
Code doesn't evolve following carefully drafted specifications, so marking certain code paths as "risky" is a must have.

tristonarmstrong commented 1 month ago

I've encountered quite a few people/library makers wishing something like this existed. I also ended up looking for this tag myself, with nothing to be found. I looked to see if there was more traffic on this, and it appears some others also request this. I imagine most people just find some hacky workaround like using deprecated or just writing a comment.

I decided i would impliment this yesterday and the day before, but i doubt this will ever get merged. The contribution guidelines require an existing backlog PR already created. Tests for it not created yet, and im not sure about the strikethrough thing, but it does what we needed for now

https://github.com/tristonarmstrong/TypeScript

Image Image